DDraceNetwork Docs
|
#include <jobs.h>
Public Member Functions | |
CJobPool () | |
~CJobPool () | |
void | Init (int NumThreads) REQUIRES(!m_Lock) |
void | Shutdown () REQUIRES(!m_Lock) REQUIRES(!m_LockRunning) |
void | Add (std::shared_ptr< IJob > pJob) REQUIRES(!m_Lock) |
Private Member Functions | |
std::shared_ptr< IJob > m_pFirstJob | GUARDED_BY (m_Lock) |
std::shared_ptr< IJob > m_pLastJob | GUARDED_BY (m_Lock) |
std::deque< std::shared_ptr< IJob > > m_RunningJobs | GUARDED_BY (m_LockRunning) |
void | RunLoop () NO_THREAD_SAFETY_ANALYSIS |
Static Private Member Functions | |
static void | WorkerThread (void *pUser) NO_THREAD_SAFETY_ANALYSIS |
Private Attributes | |
std::vector< void * > | m_vpThreads |
std::atomic< bool > | m_Shutdown |
CLock | m_Lock |
SEMAPHORE | m_Semaphore |
CLock | m_LockRunning |
A job pool which runs jobs in one or more worker threads.
CJobPool::CJobPool | ( | ) |
CJobPool::~CJobPool | ( | ) |
void CJobPool::Add | ( | std::shared_ptr< IJob > | pJob | ) |
Adds a job to the queue of the job pool.
pJob | The job to enqueue. |
|
private |
void CJobPool::Init | ( | int | NumThreads | ) |
Initializes the job pool with the given number of worker threads.
NumTheads | The number of worker threads. |
|
private |
void CJobPool::Shutdown | ( | ) |
Shuts down the job pool. Aborts all abortable jobs. Then waits for all worker threads to complete all remaining queued jobs and terminate.
|
staticprivate |
|
private |
|
private |
|
private |
|
private |
|
private |