ThreadPool Class Reference

This class exposes an interface to interact with generic task objects to be executed on background threads. This is to be used internally for the ODBC and OLEDB Async features but may also be used externally for concurrent work processing. More...

List of all members.

Public Member Functions

EventHandler GetThreadEventHandler ()
 Gets the currently set event handler.
bool IsStopped ()
 Check if the thread pool has been fully stopped.
void PostTask (ITask *in_task)
 Post a task to be run by one of the thread of the pool.
void SetThreadEventHandler (EventHandler in_eventHandler)
 Set the event handler to be used for new threads (does not affect threads already running).
void Start ()
 Starts/ReStarts the thread pool if not already running. Increments start count. Each call to Start() should eventually be matched by exactly one call to Stop().
void Stop ()
 Decrements start count. If this is 0, stops all threads.
 ThreadPool (simba_uint32 in_numThreads)
 Constructor.
 ThreadPool ()
 Constructor.
 ~ThreadPool ()
 Destructor.

Detailed Description

This class exposes an interface to interact with generic task objects to be executed on background threads. This is to be used internally for the ODBC and OLEDB Async features but may also be used externally for concurrent work processing.


Constructor & Destructor Documentation

ThreadPool (  ) 

Constructor.

Creates a thread pool with an unlimited number of threads.

ThreadPool ( simba_uint32  in_numThreads  ) 

Constructor.

Creates a finite limit to the number of running threads.

Parameters:
in_numThreads The maximum number of threads the thread pool can create. The value zero indicates that there is no limit.
~ThreadPool (  ) 

Destructor.

Does not wait for threads to terminate. It is an error to destruct ThreadPool if all calls to Start() have not yet been matched by calls to Stop().


Member Function Documentation

EventHandler GetThreadEventHandler (  ) 

Gets the currently set event handler.

Returns:
The EventHandler.
bool IsStopped (  ) 

Check if the thread pool has been fully stopped.

Returns:
True if the thread pool has been fully stopped.
void PostTask ( ITask in_task  ) 

Post a task to be run by one of the thread of the pool.

Parameters:
in_task The task to post. (NOT OWN)
Note:
DO NOT CALL THIS FROM INSIDE A THREAD RUNNING A TASK.
void SetThreadEventHandler ( EventHandler  in_eventHandler  ) 

Set the event handler to be used for new threads (does not affect threads already running).

Parameters:
in_eventHandler The event handler to use.
void Start (  ) 

Starts/ReStarts the thread pool if not already running. Increments start count. Each call to Start() should eventually be matched by exactly one call to Stop().

Note:
DO NOT CALL THIS FROM INSIDE A THREAD RUNNING A TASK.
void Stop (  ) 

Decrements start count. If this is 0, stops all threads.

Note:
DO NOT CALL THIS FROM INSIDE A THREAD RUNNING A TASK. IT WILL DEADLOCK.

The documentation for this class was generated from the following file:

Generated on Wed May 17 14:21:19 2017 for SimbaEngine 10.1.3.1011 by simba