CrystalSpace

Public API Reference

iJobQueue Struct Reference

Interface to simple job management system. More...

#include <iutil/job.h>

Inheritance diagram for iJobQueue:

List of all members.

Public Types

enum  JobStatus { NotEnqueued, Pending, Dequeued }
 

Status values for Dequeue and PullAndRun.

More...

Public Member Functions

virtual JobStatus Dequeue (iJob *job, bool waitForCompletion=false)=0
 Remove a job from the queue.
virtual void Enqueue (iJob *job)=0
 Add a job to the queue.
virtual int32 GetQueueCount ()=0
 Return the number of jobs in the queue.
virtual bool IsFinished ()=0
 Return true if all enqueued jobs are finished.
virtual JobStatus PullAndRun (iJob *job, bool waitForCompletion=true)=0
 Check if a job is still in the queue and, if so, remove it from the queue and run it immediately.
virtual void WaitAll ()=0
 Wait for all jobs in queue to finish executing.

Detailed Description

Interface to simple job management system.

The queue will execute the jobs according to the policy of the implementation, such as in parallel using multiple threads.

Remarks:
Implementations makes no gurantees as to the order or latency for job execution.
See also:
csThreadJobQueue

Definition at line 53 of file job.h.


Member Enumeration Documentation

Status values for Dequeue and PullAndRun.

Enumerator:
NotEnqueued 

The job was not enqueued.

Pending 

The job is currently running.

Dequeued 

The job was pulled from a queue and executed (PullAndRun()) resp.

dropped (PullAndDrop())

Definition at line 63 of file job.h.


Member Function Documentation

virtual JobStatus iJobQueue::Dequeue ( iJob job,
bool  waitForCompletion = false 
) [pure virtual]

Remove a job from the queue.

If the job is currently running, this will wait for it to finish if waitForCompletion is true, otherwise nothing is done.

Remarks:
The job queue will continue to hold a reference to the job if it is currently running (return value Pending). Wait for job completion if this is not desired.
virtual void iJobQueue::Enqueue ( iJob job  )  [pure virtual]

Add a job to the queue.

virtual int32 iJobQueue::GetQueueCount (  )  [pure virtual]

Return the number of jobs in the queue.

virtual bool iJobQueue::IsFinished (  )  [pure virtual]

Return true if all enqueued jobs are finished.

Remarks:
Might return wrong result if jobs are enqueued or dequeued from other threads during this call.
virtual JobStatus iJobQueue::PullAndRun ( iJob job,
bool  waitForCompletion = true 
) [pure virtual]

Check if a job is still in the queue and, if so, remove it from the queue and run it immediately.

If a job is currently running, either wait for it (waitForCompletion is true) to finish or just let it be.

Remarks:
The job queue will continue to hold a reference to the job if it is currently running (return value Pending). Wait for job completion if this is not desired.
virtual void iJobQueue::WaitAll (  )  [pure virtual]

Wait for all jobs in queue to finish executing.

Remarks:
Might return prematurely if jobs are enqueued or dequeued from other threads during this call.

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

Generated for Crystal Space 2.1 by doxygen 1.6.1