|
poser
A C framework for POsix SERvices
|
A job to be executed on a worker thread. More...
#include <poser/core/threadpool.h>
Public Member Functions | |
| PSC_ThreadJob * | PSC_ThreadJob_create (PSC_ThreadProc proc, void *arg, int timeoutTicks) |
| Create a new thread job. | |
| PSC_Event * | PSC_ThreadJob_finished (PSC_ThreadJob *self) |
| The job finished. | |
| int | PSC_ThreadJob_hasCompleted (const PSC_ThreadJob *self) |
| Determine whether the job completed. | |
| void | PSC_ThreadJob_destroy (PSC_ThreadJob *self) |
| PSC_ThreadJob destructor. | |
Static Public Member Functions | |
| int | PSC_ThreadJob_canceled (void) |
| Check whether a job was canceled. | |
A job to be executed on a worker thread.
|
static |
Check whether a job was canceled.
This must only be called from within a PSC_ThreadProc. It signals whether the job was canceled, in that case, the PSC_ThreadProc should exit quickly.
| PSC_ThreadJob * PSC_ThreadJob_create | ( | PSC_ThreadProc | proc, |
| void * | arg, | ||
| int | timeoutTicks | ||
| ) |
Create a new thread job.
Creates a new job to be executed on a worker thread.
| proc | the function to run on the worker thread |
| arg | the data to work on |
| timeoutTicks | if non-zero, automatically cancel the job after this many PSC_Service_tick() events |
| void PSC_ThreadJob_destroy | ( | PSC_ThreadJob * | self | ) |
PSC_ThreadJob destructor.
Destroys the thread job.
Note that once the job was scheduled, PSC_ThreadPool will automatically destroy it when it completed or is canceled.
| self | the PSC_ThreadJob |
| PSC_Event * PSC_ThreadJob_finished | ( | PSC_ThreadJob * | self | ) |
The job finished.
This event fires when the thread job finished, either because it completed or because it was canceled.
| self | the PSC_ThreadJob |
| int PSC_ThreadJob_hasCompleted | ( | const PSC_ThreadJob * | self | ) |
Determine whether the job completed.
This can be called when PSC_ThreadJob_finished() fired to know whether the job completed successfully.
| self | the PSC_ThreadJob |