Abstract interface for running generic computation jobs. More...
#include <Util/JobServer.H>
Classes | |
class | Job |
Base class for jobs that can be submitted to a JobServer. More... | |
Public Member Functions | |
virtual | ~JobServer () |
Virtual destructor for safe inheritance. | |
virtual void | enqueueJob (const rutz::shared_ptr< Job > &job)=0 |
Submit a job to be run. | |
virtual void | enqueueJobs (const rutz::shared_ptr< Job > *jobs, const size_t njobs) |
Submit multiple jobs in a batch. | |
virtual unsigned int | getParallelismHint ()=0 |
Return a hint as to how many jobs could naturally be run in parallel by this JobServer. |
Abstract interface for running generic computation jobs.
Definition at line 46 of file JobServer.H.
JobServer::~JobServer | ( | ) | [virtual] |
Virtual destructor for safe inheritance.
Definition at line 60 of file JobServer.C.
virtual void JobServer::enqueueJob | ( | const rutz::shared_ptr< Job > & | job | ) | [pure virtual] |
Submit a job to be run.
Depending on the JobServer subclass, the job may be run immediately or may be run at a later time, in a different thread, on a different machine, etc.
Implemented in SyncJobServer, and WorkThreadServer.
Referenced by enqueueJobs(), InputFrame::fromRgb(), InputHandlerThreaded::handleInput(), and WinnerTakeAllStdOptim::integrate().
void JobServer::enqueueJobs | ( | const rutz::shared_ptr< Job > * | jobs, | |
const size_t | njobs | |||
) | [virtual] |
Submit multiple jobs in a batch.
Depending on the JobServer subclass, this may be more efficient than a series of individual enqueueJob() calls (e.g., the subclass might be able to lock/unlock a mutex just once rather than once per submitted job).
The default implementation just repeatedly calls enqueueJob().
Reimplemented in WorkThreadServer.
Definition at line 64 of file JobServer.C.
References enqueueJob().
virtual unsigned int JobServer::getParallelismHint | ( | ) | [pure virtual] |
Return a hint as to how many jobs could naturally be run in parallel by this JobServer.
Clients might be able to use this hint to decide how to best decompose their overall algorithm into individual job requeusts.
Implemented in SyncJobServer, and WorkThreadServer.
Referenced by InputFrame::fromRgb(), and WinnerTakeAllStdOptim::integrate().