A class that allows multiple-dependency waiting. More...
#include <xsens_threadpool.h>
Public Member Functions | |
void | addWaitId (unsigned int id) |
Add the id of a task to wiat for to the list. More... | |
virtual bool | exec () |
task function, checks if there are tasks left that we should be waiting for More... | |
virtual unsigned int | needToWaitFor () |
If there are wait tasks left, this function will return the id of the first in the list. More... | |
TaskCompletionWaiter (const std::list< unsigned int > &waitlist, ThreadPool *pool=ThreadPool::instance()) | |
Constructor, sets up a waiter that waits for all items in the list to be completed. More... | |
TaskCompletionWaiter (ThreadPool *pool=ThreadPool::instance()) | |
Constructor, sets up an empty waiter. More... | |
virtual | ~TaskCompletionWaiter () |
Destructor. More... | |
![]() | |
bool | isCanceling () const |
Returns true if the task has been told to cancel itself. More... | |
unsigned int | taskId () const |
Returns the task ID of the task or 0 if it doesn't have a proper ID (yet) More... | |
ThreadPoolTask () | |
virtual | ~ThreadPoolTask () |
Private Attributes | |
ThreadPool * | m_pool |
std::list< unsigned int > | m_waitList |
A class that allows multiple-dependency waiting.
A normal task in the ThreadPool can only wait for one task ID. This class allows waiting for multiple IDs. The IDs to wait for can be supplied upon creation or added later, but they should NOT be added once the object has been scheduled. The TaskCompletionWaiter must be scheduled in the ThreadPool that contains the task IDs to wait for so it can do its job.
Definition at line 146 of file xsens_threadpool.h.
xsens::TaskCompletionWaiter::TaskCompletionWaiter | ( | ThreadPool * | pool = ThreadPool::instance() | ) |
Constructor, sets up an empty waiter.
Definition at line 807 of file xsens_threadpool.cpp.
xsens::TaskCompletionWaiter::TaskCompletionWaiter | ( | const std::list< unsigned int > & | waitlist, |
ThreadPool * | pool = ThreadPool::instance() |
||
) |
Constructor, sets up a waiter that waits for all items in the list to be completed.
Definition at line 813 of file xsens_threadpool.cpp.
|
virtual |
Destructor.
Definition at line 820 of file xsens_threadpool.cpp.
void xsens::TaskCompletionWaiter::addWaitId | ( | unsigned int | id | ) |
Add the id of a task to wiat for to the list.
id | The ID to add |
Definition at line 854 of file xsens_threadpool.cpp.
|
virtual |
task function, checks if there are tasks left that we should be waiting for
The function returns false if at least one of the wait tasks still exists
Implements xsens::ThreadPoolTask.
Definition at line 827 of file xsens_threadpool.cpp.
|
virtual |
If there are wait tasks left, this function will return the id of the first in the list.
Reimplemented from xsens::ThreadPoolTask.
Definition at line 843 of file xsens_threadpool.cpp.
|
private |
Definition at line 158 of file xsens_threadpool.h.
|
private |
Definition at line 159 of file xsens_threadpool.h.