genesis-3d_engine/Engine/foundation/jobs/tp/tpjobport.h

48 lines
1.2 KiB
C
Raw Normal View History

#pragma once
//------------------------------------------------------------------------------
/**
@class Jobs::TPJobPort
Thread-pool implementation of JobPort.
(C) 2009 Radon Labs GmbH
*/
#include "jobs/base/jobportbase.h"
//------------------------------------------------------------------------------
namespace Jobs
{
class TPJobPort : public Base::JobPortBase
{
__DeclareClass(TPJobPort);
public:
/// constructor
TPJobPort();
/// destructor
virtual ~TPJobPort();
/// discard the job port
void Discard();
/// push a job for execution
void PushJob(const GPtr<Job>& job);
/// push a job chain, each job in the chain depends on previous job
void PushJobChain(const Util::Array<GPtr<Jobs::Job> >& jobs);
/// push a flush command (no effect in thread-pool job system)
void PushFlush();
/// push a sync command
void PushSync();
/// wait for completion
void WaitDone();
/// check for completion, return immediately
bool CheckDone();
private:
GPtr<Job> lastPushedJob; // pointer to last pushed job
};
} // namespace Jobs
//------------------------------------------------------------------------------