Raven Engine v0.1
Loading...
Searching...
No Matches
Raven::JobQueue< T > Class Template Reference

A thread-safe queue for enqueuing and dequeuing jobs. More...

#include <JobQueue.h>

Public Member Functions

void Push (T job)
 Enqueues a job into the queue.
std::optional< T > Pop ()
 Attempts to dequeue a job from the queue.

Detailed Description

template<typename T>
class Raven::JobQueue< T >

A thread-safe queue for enqueuing and dequeuing jobs.

Template Parameters
TThe type of job or task to store in the queue. Must be MoveConstructible.

A templated thread-safe queue implementation for storing and retrieving jobs (or any other task type). Internally uses a mutex to protect access to the underlying std::queue. Provides a convenient alias JobQueueType for a queue of Raven::Job instances.

Member Function Documentation

◆ Pop()

template<typename T>
std::optional< T > Raven::JobQueue< T >::Pop ( )
inline

Attempts to dequeue a job from the queue.

Returns
An optional containing the job if available; std::nullopt if the queue is empty.

◆ Push()

template<typename T>
void Raven::JobQueue< T >::Push ( T job)
inline

Enqueues a job into the queue.

Parameters
jobThe job to enqueue.

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