System::Threading::ThreadPoolImpl Class Reference

Public Member Functions

ASPOSECPP_SHARED_API bool QueueUserWorkItem (WaitCallback callback, const System::SharedPtr< System::Object > &state)
 
ASPOSECPP_SHARED_API void GetAvailableThreads (int &wt, int &cpt)
 
ASPOSECPP_SHARED_API void GetMaxThreads (int &wt, int &cpt)
 
ASPOSECPP_SHARED_API void GetMinThreads (int &wt, int &cpt)
 
ASPOSECPP_SHARED_API bool SetMaxThreads (int wt, int cpt)
 
ASPOSECPP_SHARED_API bool SetMinThreads (int wt, int cpt)
 
ASPOSECPP_SHARED_API ThreadPoolImpl ()
 Constructor. More...
 
ASPOSECPP_SHARED_API ~ThreadPoolImpl ()
 Destructor. Joins all threads if they were not terminated yet. More...
 
ASPOSECPP_SHARED_API void JoinAll ()
 Joins all owned threads. Waits infinitely. More...
 

Static Public Member Functions

static ASPOSECPP_SHARED_API bool & GetInitialized ()
 

Detailed Description

Thread pool internal data. This is a singleton type with memory management done by access function(s). You should never create instances of it directly.

Constructor & Destructor Documentation

◆ ThreadPoolImpl()

ASPOSECPP_SHARED_API System::Threading::ThreadPoolImpl::ThreadPoolImpl ( )

Constructor.

◆ ~ThreadPoolImpl()

ASPOSECPP_SHARED_API System::Threading::ThreadPoolImpl::~ThreadPoolImpl ( )

Destructor. Joins all threads if they were not terminated yet.

Member Function Documentation

◆ GetAvailableThreads()

ASPOSECPP_SHARED_API void System::Threading::ThreadPoolImpl::GetAvailableThreads ( int &  wt,
int &  cpt 
)

Gets number of available threads.

Parameters
wtReference to variable to store number of awailable worker threads.
cptReference to variable to store number of awailable IO threads.

◆ GetInitialized()

static ASPOSECPP_SHARED_API bool& System::Threading::ThreadPoolImpl::GetInitialized ( )
static

Gets initialization state singleton.

Returns
Reference to variable that holds true if initialization was done already and false otherwise.

◆ GetMaxThreads()

ASPOSECPP_SHARED_API void System::Threading::ThreadPoolImpl::GetMaxThreads ( int &  wt,
int &  cpt 
)

Gets maximal number of concurrent threads.

Parameters
wtReference to variable to store maximal number of awailable worker threads.
cptReference to variable to store maximal number of awailable IO threads.

◆ GetMinThreads()

ASPOSECPP_SHARED_API void System::Threading::ThreadPoolImpl::GetMinThreads ( int &  wt,
int &  cpt 
)

Gets minimal number of threads being created by pool.

Parameters
wtReference to variable to store minimal number of awailable worker threads.
cptReference to variable to store minimal number of awailable IO threads.

◆ JoinAll()

ASPOSECPP_SHARED_API void System::Threading::ThreadPoolImpl::JoinAll ( )

Joins all owned threads. Waits infinitely.

◆ QueueUserWorkItem()

ASPOSECPP_SHARED_API bool System::Threading::ThreadPoolImpl::QueueUserWorkItem ( WaitCallback  callback,
const System::SharedPtr< System::Object > &  state 
)

Adds work item to queue.

Parameters
callbackCallback function to execute.
stateCallback function argument.
Returns
Always returns true.

◆ SetMaxThreads()

ASPOSECPP_SHARED_API bool System::Threading::ThreadPoolImpl::SetMaxThreads ( int  wt,
int  cpt 
)

Sets number of threads owned by pool.

Parameters
wtMaximal number of worker threads.
cptMaximal number of IO threads.
Returns
True if parameters were accepted, false otherwise.

◆ SetMinThreads()

ASPOSECPP_SHARED_API bool System::Threading::ThreadPoolImpl::SetMinThreads ( int  wt,
int  cpt 
)

Sets minimal number of threads owned by pool.

Parameters
wtMinimal number of worker threads.
cptMinimal number of IO threads.
Returns
True if parameters were accepted, false otherwise.