|
lcls2
C++ API: public headers of xtcdata, psalg, psdaq and psana
|
Thread that runs Routine jobs from a queue in order (TaskMainLoop). More...
#include <Task.hh>
Public Types | |
| enum | MakeThisATaskFlag { MakeThisATask } |
| Tag type that selects the constructor which wraps the calling thread instead of creating one. More... | |
Public Member Functions | |
| Task (const TaskObject &) | |
| Copy the TaskObject parameters, create the job queue and pending semaphore and start the thread with pthread_create() (stack size and priority from the parameters); a creation error is ignored. | |
| Task (const Task &) | |
| Share the thread, queue, semaphore and parameters of aTask and increment the shared reference count. | |
| Task (MakeThisATaskFlag) | |
| Wrap the calling thread: create default TaskObject parameters (thread ID of the caller), a job queue and a pending semaphore, without starting a thread. | |
| void | operator= (const Task &) |
| Share the thread, queue, semaphore and parameters of aTask; unlike the copy constructor, the reference count is not incremented. | |
| const TaskObject & | parameters () const |
| Return the TaskObject parameters. | |
| void | call (Routine *) |
| Insert routine at the tail of the job queue and give the pending semaphore if the queue was empty. | |
| void | destroy () |
| Decrement the shared reference count; if others remain, delete this handle, and if it reaches 0, queue a TaskDelete so that the thread deletes everything and exits. | |
| void | mainLoop () |
| Run TaskMainLoop() on the calling thread (used with the MakeThisATask constructor); never returns. | |
| void | signal (int signal) |
| Send signal to the task thread with pthread_kill(). | |
| bool | is_self () const |
| Return true if the calling thread is the task thread. | |
Friends | |
| class | TaskDelete |
| Lets TaskDelete call the private deleteTask(). | |
| void * | TaskMainLoop (void *) |
| Lets TaskMainLoop() reach the private job queue and semaphore. | |
Thread that runs Routine jobs from a queue in order (TaskMainLoop).
Copies share the same thread, queue and reference count.
| Pds::Task::Task | ( | const TaskObject & | ) |
Copy the TaskObject parameters, create the job queue and pending semaphore and start the thread with pthread_create() (stack size and priority from the parameters); a creation error is ignored.
| Pds::Task::Task | ( | const Task & | ) |
Share the thread, queue, semaphore and parameters of aTask and increment the shared reference count.
| Pds::Task::Task | ( | MakeThisATaskFlag | ) |
Wrap the calling thread: create default TaskObject parameters (thread ID of the caller), a job queue and a pending semaphore, without starting a thread.
| void Pds::Task::call | ( | Routine * | ) |
Insert routine at the tail of the job queue and give the pending semaphore if the queue was empty.
| void Pds::Task::destroy | ( | ) |
Decrement the shared reference count; if others remain, delete this handle, and if it reaches 0, queue a TaskDelete so that the thread deletes everything and exits.
| bool Pds::Task::is_self | ( | ) | const |
Return true if the calling thread is the task thread.
| void Pds::Task::mainLoop | ( | ) |
Run TaskMainLoop() on the calling thread (used with the MakeThisATask constructor); never returns.
| void Pds::Task::operator= | ( | const Task & | ) |
Share the thread, queue, semaphore and parameters of aTask; unlike the copy constructor, the reference count is not incremented.
| const TaskObject & Pds::Task::parameters | ( | ) | const |
Return the TaskObject parameters.
| void Pds::Task::signal | ( | int | signal | ) |
Send signal to the task thread with pthread_kill().
|
friend |
Lets TaskDelete call the private deleteTask().
|
friend |
Lets TaskMainLoop() reach the private job queue and semaphore.
Never returns.