Castor3D 0.16.0
Multiplatform 3D engine
Public Types | Public Member Functions | List of all members
castor::AsyncJobQueue Class Reference

#include <AsyncJobQueue.hpp>

Inheritance diagram for castor::AsyncJobQueue:
Inheritance graph
[legend]
Collaboration diagram for castor::AsyncJobQueue:
Collaboration graph
[legend]

Public Types

using Job = castor::Function< void() >
 
using JobArray = Vector< Job >
 

Public Member Functions

CU_API AsyncJobQueue (size_t count)
 Constructor, initialises the pool with given threads count.
 
CU_API ~AsyncJobQueue () noexcept
 Destructor.
 
CU_API void pushJob (Job job)
 Feeds a worker thread with the given job.
 
CU_API void waitAll ()
 Waits for all the jobs to be run.
 
CU_API void finish ()
 Waits for all the jobs to be run, prevents any new job push, just discards them.
 
CU_API void reset ()
 Resets the queue initial state.
 

Additional Inherited Members

- Protected Member Functions inherited from castor::NonMovable
 NonMovable ()=default
 Constructor.
 
 ~NonMovable () noexcept=default
 Destructor.
 

Member Typedef Documentation

◆ Job

◆ JobArray

Constructor & Destructor Documentation

◆ AsyncJobQueue()

CU_API castor::AsyncJobQueue::AsyncJobQueue ( size_t count)
explicit

Constructor, initialises the pool with given threads count.

Parameters
[in]countThe threads count.

◆ ~AsyncJobQueue()

CU_API castor::AsyncJobQueue::~AsyncJobQueue ( )
noexcept

Destructor.

Member Function Documentation

◆ finish()

CU_API void castor::AsyncJobQueue::finish ( )

Waits for all the jobs to be run, prevents any new job push, just discards them.

◆ pushJob()

CU_API void castor::AsyncJobQueue::pushJob ( Job job)

Feeds a worker thread with the given job.

Remarks
If no thread is available, waits for one to finish its job.
Parameters
[in]jobThe job.

◆ reset()

CU_API void castor::AsyncJobQueue::reset ( )

Resets the queue initial state.

◆ waitAll()

CU_API void castor::AsyncJobQueue::waitAll ( )

Waits for all the jobs to be run.


The documentation for this class was generated from the following file: