m_JobState = m_Job->Run();
58m_Engine.x_OnTaskStatusChange(*
this, m_JobState);
60 catch(std::exception&)
95 unsigned intqueue_size)
144s +=
" has been already started on this Engine";
165handle->GetJob().RequestCancel();
173 static const char* kMsg =
"CThreadPoolEngine::SuspendJob()\ 174 - operation is not supported";
181 static const char* kMsg =
"CThreadPoolEngine::ResumeJob()\ 182 - operation is not supported";
197 const THandle& handle = it->second;
279s +=
" is not registered with this Engine";
299s +=
" is not registred with this Engine";
IAppJobListener Interface for components that need to be notified about changes in Jobs.
IAppJob to CThreadPool_Task Adaptor.
IAppJobEngineListener - receives notifications about changes in job state.
container_type::const_iterator const_iterator
container_type::iterator iterator
const_iterator end() const
const_iterator find(const key_type &key) const
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
virtual void x_OnTaskStatusChange(CThreadTask &task, IAppJob::EJobState new_status)
virtual EStatus Execute(void)
Do the actual job.
virtual bool IsActive()
Returns true if Engine supports "active" model i.e.
IAppJobEngineListener * m_Listener
CThreadTask(IAppJob &job, CThreadPoolEngine &engine)
virtual void SetListener(IAppJobEngineListener *listener)
For "active" mode set a Listener that will be notified when the state of a Job changes.
virtual ~CThreadPoolEngine()
virtual void CancelJob(IAppJob &job)
Cancel job in the engine If job is not running yet - just remove from the pending queue otherwise use...
CThreadPool m_ThreadPool
pool of threads with a request queue
EJobState
Job states (describe FSM)
virtual string GetDescr() const =0
Returns a human readable description of the Job (optional)
void StartJob(IAppJob &job, IEngineParams *params=NULL)
If Engine cannot start the Job and exception shall be thrown.
void RemoveJobRecord(IAppJob &job)
virtual void RequestCancel()
asyncronous request all jobs to Cancel
TJobToHandle::iterator x_Find(IAppJob &job)
try to find a job, if not found - throws an exception
TJobToHandle m_JobToHandle
virtual void ShutDown()
stop any background threads and free resources associated with the Engine
virtual TJobState GetJobState(IAppJob &job) const
CThreadPoolEngine(unsigned int max_threads, unsigned int queue_size)
virtual void SuspendJob(IAppJob &job)
virtual void OnEngineJobStateChanged(IAppJob &job, TJobState new_state)=0
virtual void ResumeJob(IAppJob &job)
@ eEngineBusy
Engine is busy, caller needs to re-try the operation.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
void CancelTask(CThreadPool_Task *task)
Request to cancel the task and remove it from queue if it is there.
EStatus GetStatus(void) const
Get status of the task.
void Abort(const CTimeSpan *timeout=NULL)
Abort all functions of the pool â cancel all queued tasks, send cancellation notifications to all cur...
EStatus
Status of the task.
void CancelTasks(TExclusiveFlags tasks_group)
Cancel the selected groups of tasks in the pool.
void AddTask(CThreadPool_Task *task, const CTimeSpan *timeout=NULL)
Add task to the pool for execution.
@ eIdle
has not been placed in queue yet
@ eQueued
in the queue, awaiting execution
@ eExecuting
being executed
@ eFailed
failure during execution
@ eCompleted
executed successfully
@ eCanceled
canceled - possible only if canceled before processing was started or if method Execute() returns res...
@ fCancelQueuedTasks
Cancel all tasks waiting in the queue and not yet executing.
@ fCancelExecutingTasks
Cancel all currently executing tasks.
void SleepMilliSec(unsigned long ml_sec, EInterruptOnSignal onsignal=eRestartOnSignal)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4