CppCMS
|
This class provides an access to the thread pool where all CppCMS synchronous applications are executed. More...
#include <cppcms/thread_pool.h>
Public Member Functions | |
int | post (booster::function< void()> const &job) |
bool | cancel (int id) |
This class provides an access to the thread pool where all CppCMS synchronous applications are executed.
Users of asynchronous applications or tasks my send their jobs for the execution in the thread_pool
bool cppcms::thread_pool::cancel | ( | int | id | ) |
Cancel the job using id received from post() function
Returns true if the job was removed from the queue and false if the operation failed: the job execution is in the process or completed
Note: the id is just a rolling number and job ids may be repeated once in a while, so it is good idea to check if the job was completed before cancelling the job (even it is unlikely the 4 billion jobs would be executed in small period of time.
int cppcms::thread_pool::post | ( | booster::function< void()> const & | job | ) |
Post a request for execution of job in the pool. Received integer is special job identification number that can be used to remove the job from the queue.