Nebula
Loading...
Searching...
No Matches
Jobs::JobThread Class Reference

#include <jobs.h>

Inherits Thread.

Classes

struct  JobThreadCommand

Public Types

enum  JobThreadCommandType { RunJob , Signal , Wait , WaitAndReset }

Public Member Functions

 JobThread ()
 constructor
virtual ~JobThread ()
 destructor
void EmitWakeupSignal ()
 called if thread needs a wakeup call before stopping
void DoWork ()
 this method runs in the thread context
bool HasWork ()
 returns true if thread has work
void RunJobSlices (uint sliceIndex, uint numSlices, const JobContext ctx, void(*JobFunc)(const JobFuncContext &ctx), const std::function< void()> *callback)
 push a set of job slices
void PushCommand (const JobThreadCommand &command)
 push command buffer work
void PushCommands (const Util::Array< JobThreadCommand > &commands)
 push command buffer work

Private Member Functions

 __DeclareClass (JobThread)

Private Attributes

Threading::SafeQueue< JobThreadCommandcommands
ubytescratchBuffer

Static Private Attributes

static const SizeT MaxScratchSize = (64 * 1024)

Member Enumeration Documentation

◆ JobThreadCommandType

Enumerator
RunJob 
Signal 
Wait 
WaitAndReset 

Constructor & Destructor Documentation

◆ JobThread()

Jobs::JobThread::JobThread ( )

constructor

◆ ~JobThread()

Jobs::JobThread::~JobThread ( )
virtual

destructor

Member Function Documentation

◆ __DeclareClass()

Jobs::JobThread::__DeclareClass ( JobThread )
private

◆ DoWork()

void Jobs::JobThread::DoWork ( )

this method runs in the thread context

◆ EmitWakeupSignal()

void Jobs::JobThread::EmitWakeupSignal ( )

called if thread needs a wakeup call before stopping

◆ HasWork()

bool Jobs::JobThread::HasWork ( )

returns true if thread has work

◆ PushCommand()

void Jobs::JobThread::PushCommand ( const JobThreadCommand & command)

push command buffer work

◆ PushCommands()

void Jobs::JobThread::PushCommands ( const Util::Array< JobThreadCommand > & commands)

push command buffer work

◆ RunJobSlices()

void Jobs::JobThread::RunJobSlices ( uint sliceIndex,
uint numSlices,
const JobContext ctx,
void(* JobFunc )(const JobFuncContext &ctx),
const std::function< void()> * callback )

push a set of job slices

Member Data Documentation

◆ commands

Threading::SafeQueue<JobThreadCommand> Jobs::JobThread::commands
private

◆ MaxScratchSize

const SizeT Jobs::JobThread::MaxScratchSize = (64 * 1024)
staticprivate

◆ scratchBuffer

ubyte* Jobs::JobThread::scratchBuffer
private

The documentation for this class was generated from the following files:
  • /github/workspace/code/foundation/jobs/jobs.h
  • /github/workspace/code/foundation/jobs/jobs.cc