This is a "worker pool." A single thread places tasks in a queue. Each IThread is then a task, rather than its own separate thread.
More...
#include <public/IThreader.h>
This is a "worker pool." A single thread places tasks in a queue. Each IThread is then a task, rather than its own separate thread.
virtual SourceMod::IThreadWorker::~IThreadWorker |
( |
| ) |
|
|
inlinevirtual |
virtual WorkerState SourceMod::IThreadWorker::GetStatus |
( |
unsigned int * |
numThreads | ) |
|
|
pure virtual |
Returns the status of the worker.
- Parameters
-
numThreads | Pointer to store number of threads in the queue. |
- Returns
- State of the worker.
virtual bool SourceMod::IThreadWorker::Pause |
( |
| ) |
|
|
pure virtual |
Pauses the worker.
- Returns
- True on success, false otherwise.
virtual unsigned int SourceMod::IThreadWorker::RunFrame |
( |
| ) |
|
|
pure virtual |
Runs one "frame" of the worker.
- Returns
- Number of tasks processed.
virtual void SourceMod::IThreadWorker::SetMaxThreadsPerFrame |
( |
unsigned int |
threads | ) |
|
|
pure virtual |
Sets the number of threads to run per frame. Default value is 1 thread per frame.
- Parameters
-
threads | Number of threads to run per frame. |
virtual void SourceMod::IThreadWorker::SetThinkTimePerFrame |
( |
unsigned int |
thinktime | ) |
|
|
pure virtual |
For threaded workers, the think time of a frame. Has no effect for non-threaded workers. Default value is 50ms.
- Parameters
-
thinktime | Number of ms to sleep between frame execution. |
virtual bool SourceMod::IThreadWorker::Start |
( |
| ) |
|
|
pure virtual |
Starts the worker thread.
- Returns
- True on success, false otherwise.
virtual bool SourceMod::IThreadWorker::Stop |
( |
bool |
flush | ) |
|
|
pure virtual |
Stops the worker thread.
- Parameters
-
flush | If true, all remaining tasks will be cancelled. Otherwise, the threader will wait until the queue is empty. |
- Returns
- True on success, false otherwise.
virtual bool SourceMod::IThreadWorker::Unpause |
( |
| ) |
|
|
pure virtual |
Unpauses the worker.
- Returns
- True on success, false otherwise.
The documentation for this class was generated from the following file: