8#ifndef INCLUDED_BDLMT_THREADPOOL
9#define INCLUDED_BDLMT_THREADPOOL
386#include <bdlf_bind.h>
409#include <bsl_deque.h>
410#if defined(BSLS_PLATFORM_OS_UNIX)
411 #include <bsl_csignal.h>
413#include <bsl_functional.h>
414#include <bsl_string.h>
416#ifndef BDE_DONT_ALLOW_TRANSITIVE_INCLUDES
422#ifndef BDE_OMIT_INTERNAL_DEPRECATED
432struct ThreadPoolWaitNode;
472 const int d_maxThreads;
477 const int d_minThreads;
493 int d_numActiveThreads;
514#if defined(BSLS_PLATFORM_OS_UNIX)
523 static const char s_defaultThreadName[16];
533 void doEnqueueJob(
const Job& job);
547 void wakeThreadIfNeeded();
553 int startThreadIfNeeded();
555#if defined(BSLS_PLATFORM_OS_UNIX)
562 int startNewThread();
769 return enqueueJob(bdlf::BindUtil::bindR<void>(function, userData));
795 return d_createFailures;
807 return d_maxIdleTime;
Definition bdlm_metricsregistry.h:287
Definition bdlm_metricsregistry.h:199
Definition bdlmt_threadpool.h:449
double percentBusy() const
bsl::function< void()> Job
Definition bdlmt_threadpool.h:453
int threadFailures() const
Return the number of times that thread creation failed.
Definition bdlmt_threadpool.h:793
int enqueueJob(const Job &functor)
ThreadPool(const bslmt::ThreadAttributes &threadAttributes, int minThreads, int maxThreads, int maxIdleTime, bslma::Allocator *basicAllocator=0)
int maxThreads() const
Definition bdlmt_threadpool.h:787
int enqueueJob(bslmf::MovableRef< Job > functor)
ThreadPool(const bslmt::ThreadAttributes &threadAttributes, int minThreads, int maxThreads, bsls::TimeInterval maxIdleTime, const bsl::string_view &threadPoolName, bdlm::MetricsRegistry *metricsRegistry, bslma::Allocator *basicAllocator=0)
int minThreads() const
Definition bdlmt_threadpool.h:781
int numPendingJobs() const
BSLMF_NESTED_TRAIT_DECLARATION(ThreadPool, bslma::UsesBslmaAllocator)
ThreadPool(const bslmt::ThreadAttributes &threadAttributes, int minThreads, int maxThreads, bsls::TimeInterval maxIdleTime, bslma::Allocator *basicAllocator=0)
bsls::TimeInterval maxIdleTimeInterval() const
Definition bdlmt_threadpool.h:805
int maxIdleTime() const
Definition bdlmt_threadpool.h:799
int numWaitingThreads() const
Return the number of threads that are currently waiting for a job.
int numActiveThreads() const
Return the number of threads that are currently processing a job.
friend void * ThreadPoolEntry(void *)
Entry point for processing threads.
int enabled() const
Return the state (enabled or not) of the thread pool.
Definition bdlmt_threadpool.h:775
double resetPercentBusy()
ThreadPool(const bslmt::ThreadAttributes &threadAttributes, int minThreads, int maxThreads, int maxIdleTime, const bsl::string_view &threadPoolName, bdlm::MetricsRegistry *metricsRegistry, bslma::Allocator *basicAllocator=0)
~ThreadPool()
Call shutdown() and destroy this thread pool.
Definition bslstl_stringview.h:441
Definition bslstl_deque.h:772
Forward declaration.
Definition bslstl_function.h:934
Definition bslma_allocator.h:457
Definition bslmf_movableref.h:751
Definition bslmt_condition.h:220
Definition bslmt_mutex.h:315
Definition bslmt_threadattributes.h:356
Definition bsls_atomic.h:892
Definition bsls_atomic.h:743
Definition bsls_atomic.h:1349
Definition bsls_timeinterval.h:301
BSLS_KEYWORD_CONSTEXPR_CPP14 bsls::Types::Int64 totalMilliseconds() const
Definition bsls_timeinterval.h:1384
void(* bcep_ThreadPoolJobFunc)(void *)
Definition bdlmt_threadpool.h:426
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
Definition bdlmt_eventscheduler.h:522
void(* ThreadPoolJobFunc)(void *)
Definition bdlmt_threadpool.h:439
void * ThreadPoolEntry(void *)
Entry point for processing threads.
Definition bslma_usesbslmaallocator.h:343