folly/folly/executors/BUCK

load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library")

oncall("fbcode_entropy_wardens_folly")

cpp_library(
    name = "executors",
    exported_deps = [
        ":async",  # @manual
        ":cpu_thread_pool_executor",  # @manual
        ":fiber_io_executor",  # @manual
        ":future_executor",  # @manual
        ":global_executor",  # @manual
        ":io_executor",  # @manual
        ":io_object_cache",  # @manual
        ":io_thread_pool_executor",  # @manual
        ":serial_executor",  # @manual
        ":thread_pool_executor",  # @manual
        ":threaded_executor",  # @manual
        "//folly/executors/task_queue:blocking_queue",  # @manual
        "//folly/executors/task_queue:lifo_sem_mpmc_queue",  # @manual
        "//folly/executors/task_queue:priority_lifo_sem_mpmc_queue",  # @manual
        "//folly/executors/task_queue:unbounded_blocking_queue",  # @manual
        "//folly/executors/thread_factory:named_thread_factory",  # @manual
        "//folly/executors/thread_factory:priority_thread_factory",  # @manual
        "//folly/executors/thread_factory:thread_factory",  # @manual
    ],
)

cpp_library(
    name = "async",
    headers = ["Async.h"],
    exported_deps = [
        ":global_executor",
        "//folly/futures:core",
    ],
)

cpp_library(
    name = "codel",
    srcs = ["Codel.cpp"],
    headers = ["Codel.h"],
    deps = [
        "//folly/portability:gflags",
    ],
)

cpp_library(
    name = "cpu_thread_pool_executor",
    srcs = ["CPUThreadPoolExecutor.cpp"],
    headers = ["CPUThreadPoolExecutor.h"],
    deps = [
        "//folly:executor",
        "//folly:memory",
        "//folly:optional",
        "//folly/executors/task_queue:priority_lifo_sem_mpmc_queue",
        "//folly/executors/task_queue:priority_unbounded_blocking_queue",
        "//folly/executors/task_queue:unbounded_blocking_queue",
        "//folly/portability:gflags",
        "//folly/synchronization:throttled_lifo_sem",
    ],
    exported_deps = [
        ":queue_observer",
        ":thread_pool_executor",
    ],
)

cpp_library(
    name = "drivable_executor",
    headers = ["DrivableExecutor.h"],
    exported_deps = [
        "//folly:executor",
    ],
)

cpp_library(
    name = "edf_thread_pool_executor",
    srcs = ["EDFThreadPoolExecutor.cpp"],
    headers = ["EDFThreadPoolExecutor.h"],
    deps = [
        "//folly:scope_guard",
        "//folly/concurrency:process_local_unique_id",
        "//folly/synchronization:lifo_sem",
        "//folly/synchronization:throttled_lifo_sem",
        "//folly/tracing:static_tracepoint",
    ],
    exported_deps = [
        ":soft_real_time_executor",
        ":thread_pool_executor",
    ],
    external_deps = [
        "glog",
    ],
)

cpp_library(
    name = "fiber_io_executor",
    headers = ["FiberIOExecutor.h"],
    exported_deps = [
        ":io_executor",
        "//folly/fibers:fiber_manager_map",
    ],
)

cpp_library(
    name = "future_executor",
    headers = ["FutureExecutor.h"],
    exported_deps = [
        "//folly/functional:invoke",
        "//folly/futures:core",
    ],
)

cpp_library(
    name = "global_executor",
    srcs = ["GlobalExecutor.cpp"],
    headers = ["GlobalExecutor.h"],
    deps = [
        ":cpu_thread_pool_executor",
        ":inline_executor",
        ":io_thread_pool_executor",
        "//folly:function",
        "//folly:shared_mutex",
        "//folly:singleton",
        "//folly/detail:async_trace",
        "//folly/system:hardware_concurrency",
    ],
    exported_deps = [
        ":io_executor",
        "//folly:executor",
        "//folly/portability:gflags",
    ],
)

cpp_library(
    name = "global_thread_pool_list",
    srcs = ["GlobalThreadPoolList.cpp"],
    headers = ["GlobalThreadPoolList.h"],
    deps = [
        "//folly:cpp_attributes",
        "//folly/system:thread_id",
    ],
    exported_deps = [
        "//folly:indestructible",
        "//folly:synchronized",
        "//folly:thread_local",
    ],
)

cpp_library(
    name = "inline_executor",
    srcs = ["InlineExecutor.cpp"],
    headers = ["InlineExecutor.h"],
    deps = [
        "//folly:indestructible",
    ],
    exported_deps = [
        "//folly:c_portability",
        "//folly:cpp_attributes",
        "//folly:executor",
    ],
)

cpp_library(
    name = "manual_executor",
    srcs = ["ManualExecutor.cpp"],
    headers = ["ManualExecutor.h"],
    exported_deps = [
        "//folly/executors:drivable_executor",
        "//folly/executors:scheduled_executor",
        "//folly/executors:sequenced_executor",
        "//folly/synchronization:lifo_sem",
    ],
)

cpp_library(
    name = "io_executor",
    headers = ["IOExecutor.h"],
    exported_deps = [
        "//folly:executor",
    ],
)

cpp_library(
    name = "io_object_cache",
    headers = ["IOObjectCache.h"],
    exported_deps = [
        ":global_executor",
        "//folly:thread_local",
        "//folly/io/async:async_base",
    ],
)

cpp_library(
    name = "io_thread_pool_executor",
    srcs = ["IOThreadPoolExecutor.cpp"],
    headers = ["IOThreadPoolExecutor.h"],
    deps = [
        "//folly/detail:memory_idler",
        "//folly/portability:gflags",
    ],
    exported_deps = [
        ":io_executor",
        ":queue_observer",
        ":thread_pool_executor",
        "//folly:portability",
        "//folly/io/async:event_base_manager",
        "//folly/synchronization:relaxed_atomic",
    ],
    external_deps = [
        "glog",
    ],
)

cpp_library(
    name = "soft_real_time_executor",
    srcs = ["SoftRealTimeExecutor.cpp"],
    headers = ["SoftRealTimeExecutor.h"],
    exported_deps = [
        "//folly:executor",
    ],
    external_deps = [
        "glog",
    ],
)

cpp_library(
    name = "scheduled_executor",
    headers = ["ScheduledExecutor.h"],
    exported_deps = [
        "//folly:executor",
        "//folly/lang:exception",
    ],
)

cpp_library(
    name = "serial_executor",
    headers = [
        "SerialExecutor.h",
        "SerialExecutor-inl.h",
    ],
    exported_deps = [
        ":global_executor",
        ":serialized_executor",
        "//folly:exception_string",
        "//folly:scope_guard",
        "//folly/concurrency:unbounded_queue",
        "//folly/io/async:request_context",
        "//folly/synchronization:distributed_mutex",
        "//folly/synchronization:relaxed_atomic",
    ],
    exported_external_deps = [
        "glog",
    ],
)

cpp_library(
    name = "sequenced_executor",
    headers = ["SequencedExecutor.h"],
    exported_deps = [
        "//folly:executor",
    ],
)

cpp_library(
    name = "serialized_executor",
    headers = ["SerializedExecutor.h"],
    exported_deps = [
        ":sequenced_executor",
    ],
)

cpp_library(
    name = "strand_executor",
    srcs = ["StrandExecutor.cpp"],
    headers = ["StrandExecutor.h"],
    deps = [
        ":global_executor",
        "//folly:exception_string",
    ],
    exported_deps = [
        ":serialized_executor",
        "//folly:optional",
        "//folly/concurrency:unbounded_queue",
        "//folly/io/async:request_context",
    ],
    external_deps = [
        "glog",
    ],
)

cpp_library(
    name = "thread_pool_executor",
    srcs = ["ThreadPoolExecutor.cpp"],
    headers = ["ThreadPoolExecutor.h"],
    deps = [
        "//folly/concurrency:process_local_unique_id",
        "//folly/portability:pthread",
        "//folly/synchronization:asymmetric_thread_fence",
        "//folly/tracing:static_tracepoint",
    ],
    exported_deps = [
        ":global_thread_pool_list",
        "//folly:default_keep_alive_executor",
        "//folly:memory",
        "//folly:shared_mutex",
        "//folly/executors/task_queue:lifo_sem_mpmc_queue",
        "//folly/executors/thread_factory:named_thread_factory",
        "//folly/io/async:request_context",
        "//folly/portability:gflags",
        "//folly/synchronization:atomic_struct",
        "//folly/synchronization:baton",
    ],
    exported_external_deps = [
        "glog",
    ],
)

cpp_library(
    name = "threaded_executor",
    srcs = ["ThreadedExecutor.cpp"],
    headers = ["ThreadedExecutor.h"],
    deps = [
        "//folly:scope_guard",
        "//folly/executors/thread_factory:named_thread_factory",
        "//folly/system:thread_name",
    ],
    exported_deps = [
        "//folly:executor",
        "//folly/concurrency:unbounded_queue",
        "//folly/container:f14_hash",
        "//folly/executors/thread_factory:thread_factory",
    ],
    external_deps = [
        "glog",
    ],
)

cpp_library(
    name = "timed_drivable_executor",
    srcs = ["TimedDrivableExecutor.cpp"],
    headers = ["TimedDrivableExecutor.h"],
    exported_deps = [
        ":drivable_executor",
        "//folly/concurrency:unbounded_queue",
    ],
)

cpp_library(
    name = "timekeeper_scheduled_executor",
    srcs = ["TimekeeperScheduledExecutor.cpp"],
    headers = ["TimekeeperScheduledExecutor.h"],
    exported_deps = [
        ":scheduled_executor",
        "//folly/futures:core",
    ],
    exported_external_deps = [
        "glog",
    ],
)

cpp_library(
    name = "queued_immediate_executor",
    srcs = ["QueuedImmediateExecutor.cpp"],
    headers = ["QueuedImmediateExecutor.h"],
    deps = [
        "//folly:indestructible",
        "//folly:scope_guard",
    ],
    exported_deps = [
        ":inline_executor",
        "//folly:executor",
        "//folly:thread_local",
        "//folly/io/async:request_context",
    ],
)

cpp_library(
    name = "executor_with_priority",
    srcs = ["ExecutorWithPriority.cpp"],
    headers = [
        "ExecutorWithPriority.h",
        "ExecutorWithPriority-inl.h",
    ],
    exported_deps = [
        "//folly:executor",
    ],
    exported_external_deps = [
        "glog",
    ],
)

cpp_library(
    name = "metered_executor",
    headers = [
        "MeteredExecutor.h",
        "MeteredExecutor-inl.h",
    ],
    exported_deps = [
        ":queue_observer",
        "//folly:default_keep_alive_executor",
        "//folly/concurrency:unbounded_queue",
        "//folly/io/async:async_base",
    ],
)

cpp_library(
    name = "io_thread_pool_deadlock_detector_observer",
    srcs = ["IOThreadPoolDeadlockDetectorObserver.cpp"],
    headers = ["IOThreadPoolDeadlockDetectorObserver.h"],
    exported_deps = [
        "//folly:singleton",
        "//folly/concurrency:deadlock_detector",
        "//folly/executors:io_thread_pool_executor",
        "//folly/executors:thread_pool_executor",
    ],
)

cpp_library(
    name = "queue_observer",
    srcs = ["QueueObserver.cpp"],
    headers = [
        "QueueObserver.h",
    ],
    exported_deps = [
        "//folly:function",
        "//folly:portability",
        "//folly:synchronized",
        "//folly/portability:sys_types",
    ],
)

cpp_library(
    name = "virtual_executor",
    headers = [
        "VirtualExecutor.h",
    ],
    exported_deps = [
        "//folly:default_keep_alive_executor",
    ],
)

cpp_library(
    name = "function_scheduler",
    srcs = ["FunctionScheduler.cpp"],
    headers = ["FunctionScheduler.h"],
    deps = [
        "//folly:conv",
        "//folly:random",
        "//folly:string",
        "//folly/system:thread_name",
    ],
    exported_deps = [
        "//folly:function",
        "//folly:range",
        "//folly/container:f14_hash",
        "//folly/hash:hash",
    ],
    external_deps = [
        "glog",
    ],
)

cpp_library(
    name = "threaded_repeating_function_runner",
    srcs = ["ThreadedRepeatingFunctionRunner.cpp"],
    headers = ["ThreadedRepeatingFunctionRunner.h"],
    deps = [
        "//folly/system:thread_name",
    ],
    exported_deps = [
        "//folly:function",
    ],
    external_deps = [
        "glog",
    ],
)

cpp_library(
    name = "execution_observer",
    srcs = ["ExecutionObserver.cpp"],
    headers = ["ExecutionObserver.h"],
    deps = [
        "//folly/tracing:static_tracepoint",
    ],
    exported_external_deps = [
        "boost",
    ],
)