VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Friends
DtAsyncJobServer Class Reference

Manages async job objects.

The server must not be deleted before all of its jobs have completed.

Classes

class  JobListScopeGuard
 

Public Member Functions

 DtAsyncJobServer ()
 
virtual ~DtAsyncJobServer ()
 
virtual boost::shared_ptr
< DtAsyncJobMapEntry
addJob (DtAsyncJob *job)
 
virtual void cancelAllJobs ()
 
virtual void cancelAllJobsAndWait ()
 
virtual bool empty () const
 
virtual bool running () const
 
virtual void printAsyncJobMap ()
 
virtual void tick ()
 

Protected Types

typedef tbb::spin_mutex Mutex
 
typedef std::list< DtAsyncJob * > JobList
 

Protected Member Functions

virtual size_t getNextId ()
 
virtual void remove (size_t id)
 
virtual void jobDestroyed (DtAsyncJob &)
 

Protected Attributes

DtAsyncJobMap myAsyncJobMap
 
Mutex myIdGenMutex
 
size_t myNextId
 
Mutex myNumTasksMutex
 
size_t myNumTasks
 
Mutex myJobListMutex
 
JobList myCurrentJobs
 

Friends

class DtAsyncJobMapEntry
 
class DtAsyncJob
 

Member Typedef Documentation

typedef tbb::spin_mutex DtAsyncJobServer::Mutex
protected
typedef std::list<DtAsyncJob*> DtAsyncJobServer::JobList
protected

Constructor & Destructor Documentation

DtAsyncJobServer::DtAsyncJobServer ( )

CTOR.

virtual DtAsyncJobServer::~DtAsyncJobServer ( )
virtual

Virtual DTOR.

Member Function Documentation

virtual boost::shared_ptr<DtAsyncJobMapEntry> DtAsyncJobServer::addJob ( DtAsyncJob job)
virtual

Add a job to the queue.

Parameters
jobJob object to add. Make sure it has been allocated with tbb placement new allocator (see DtAsyncJob documentation). Do not save a pointer to the job object, it cannot be accessed outside of the server after it has been added. Use the returned job map entry object.
Returns
Job map entry object used to communicate with job.
virtual void DtAsyncJobServer::cancelAllJobs ( )
virtual

Set all jobs to cancelled.

virtual void DtAsyncJobServer::cancelAllJobsAndWait ( )
virtual

Set all jobs to cancelled and wait for them to complete.

virtual bool DtAsyncJobServer::empty ( ) const
virtual

Check to see if there are any jobs in the queue.

virtual bool DtAsyncJobServer::running ( ) const
virtual

Are there currently jobs which are waiting to run or haven't completed?

virtual void DtAsyncJobServer::printAsyncJobMap ( )
virtual

Prints async job IDs and status.

virtual void DtAsyncJobServer::tick ( )
virtual

Called each tick, ticks each job.

virtual size_t DtAsyncJobServer::getNextId ( )
protectedvirtual

Get the next id.

virtual void DtAsyncJobServer::remove ( size_t  id)
protectedvirtual

Remove id immediately.

virtual void DtAsyncJobServer::jobDestroyed ( DtAsyncJob )
protectedvirtual

DtAsyncJob object added previously has been destroyed.

Friends And Related Function Documentation

friend class DtAsyncJobMapEntry
friend
friend class DtAsyncJob
friend

Member Data Documentation

DtAsyncJobMap DtAsyncJobServer::myAsyncJobMap
protected
Mutex DtAsyncJobServer::myIdGenMutex
mutableprotected
size_t DtAsyncJobServer::myNextId
protected
Mutex DtAsyncJobServer::myNumTasksMutex
mutableprotected
size_t DtAsyncJobServer::myNumTasks
protected
Mutex DtAsyncJobServer::myJobListMutex
mutableprotected
JobList DtAsyncJobServer::myCurrentJobs
protected

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

Document ID: Generated on Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)