;
82: m_ServiceLocator(
NULL),
83m_EventLogService(
NULL),
127(*it)->m_Task->SetListener(
NULL);
164 "Cannot perform operation, Task Manager has been shut down.";
177rec->m_Task.
Reset(&task);
187 "CAppTaskService::x_ExecuteNextTaskInQueue() - cannot execute task.";
225}
catch(std::exception& ee) {
231 if( ! err_msg.empty()) {
276 ERR_POST(
"CAppTaskService::x_ExecuteNextTaskInQueue() - unexpected state.");
288 const string& prefix,
IAppTask& task,
289 const string& postfix,
const string& details)
293 stringtitle = prefix +
"\""+ task.
GetDescr() +
"\""+ postfix;
307 "\" failed. Details : "<< err_msg);
309 strings = err_msg +
" "+ details;
316 "Cannot cancel the task, it is not running in background";
318 "Unexpected fatal error while trying to cancel the task ";
334 for(; it2 != guard.
End(); ++it2) {
335 if(ref.
GetPointer() == (**it2).m_Task.GetPointer()) {
342 if(it2 == guard.
End()) {
343 if(throw_on_error) {
356}
catch(std::exception& ee) {
366 "Task Manager - notification for unexpected task (";
442tasks.push_back(rec);
453tasks.push_back(it->second);
464 IAppTask& task = *it->second->m_Task;
static const char * kUnexpectedTaskNot
static const char * kCancelUnknown
string sGetMessageAndReport(const string &prefix, IAppTask &task, CException &e)
CAppTaskService.
ON_EVENT(CAppTaskServiceEvent, CAppTaskServiceEvent::eWakeUpSignal, &CAppTaskService::x_OnWakeUpSignal) ON_EVENT(CAppTaskServiceEvent
static const char * kCancelFatal
static const char * kShutDown
static const char * kExecErr
CAppTaskServiceException.
CAppTaskService - Application Task Service.
CEventLogService - the standard implementation of IEventLogService.
CEventRecord - standard implementation of IEventRecord.
CEvent - generic event implementation TODO TODO - Attachments.
Access guard to non-constant CSyncQueue.
TIterator End(void)
Get iterator pointing to the tail of the queue.
TIterator Begin(void)
Get iterator pointing to the head of the queue.
TIterator Erase(TIterator iter)
Erase one element in the queue.
Iterator for CSyncQueue (constant or non-constant depending on template parameters).
void Push(const TValue &elem, const CTimeSpan *timeout=NULL)
Add new element to the end of queue.
bool IsEmpty(void) const
Check if the queue is empty.
TValue Pop(const CTimeSpan *timeout=NULL)
Retrieve an element from the queue.
void Clear(const CTimeSpan *timeout=NULL)
Remove all elements from the queue.
IServiceLocator - an abstract mechanism for locating services.
container_type::iterator iterator
const_iterator end() const
const_iterator find(const key_type &key) const
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
const string & GetMsg(void) const
Get message string.
string ReportAll(TDiagPostFlags flags=eDPF_Exception) const
Report all exceptions.
void Info(CExceptionArgs_Base &args)
bool CancelTask(IAppTask &task, bool throw_on_error=true)
Places a request to cancel a backgrounded task.
virtual void CancelBackgrounded()=0
make a request to cancel backgrounded task (not called for foreground tasks)
CIRef< T > GetServiceByType()
retrieves a typed reference to a service, the name of C++ type is used as the name of the service.
virtual void AddRecord(IEventRecord *record)=0
Records are managed by CIRef inside the service.
virtual void ShutDownService()
Cancels all backgrounded tasks, removes pending tasks and blocks processing of incoming requests and ...
void AddTask(IAppTask &task)
Add a task to the queue.
IEventLogService * m_EventLogService
virtual ~CAppTaskService()
TRecordMap m_BackgoundedTasks
virtual ETaskState Run()=0
execute the task, this function is called on the main UI thread if a task needs to execute in backgro...
virtual string GetStatusText() const =0
returns human-readable text describing the current task state
virtual void SetListener(CEventHandler *handler)=0
set a Listener; this allows a taks running in background to notify the Listener (usually Task Manager...
void x_OnStatusUpdate(CEvent *event)
void x_ReportTaskFailure(IAppTask &task, const string &err_msg, const string &details)
void GetBackgroundedTasks(TRecRefVec &tasks)
void x_LogTask(IEventRecord::EType type, const string &prefix, IAppTask &task, const string &postfix, const string &details=kEmptyStr)
void PreShutDownService()
virtual ETaskState GetState()=0
returns the current task state
vector< TRecordRef > TRecRefVec
ETaskState
List of task states defining the task management FSM.
virtual void SetServiceLocator(IServiceLocator *srv_locator)
bool IdleCallback()
This function shall be called in the the application idle function, it polls the Task Queue and execu...
void x_ExecuteNextTaskInQueue()
void x_OnTaskCanceled(CEvent *event)
virtual void InitService()
void x_OnWakeUpSignal(CEvent *event)
int GetRunningTasksCount(bool vis_only=true)
returns the number of running and backgrounded tasks
virtual string GetDescr() const =0
returns a human-readable description of the Task (optional)
void GetPendingTasks(TRecRefVec &tasks)
Inspection interface - supposed to be used from the main UI thread only.
IServiceLocator * m_ServiceLocator
CIRef< IAppTask > GetTask()
virtual bool IsVisible()=0
returns true if the task should be visible in UI visible task shall represent operations understood b...
@ eCanceled
canceled by Task Manager
@ eBackgrounded
task is executing in background
@ eFailed
failed during execution
@ eCompleted
successfully finished
@ eInitial
has not been executed yet
static CAppJobDispatcher & GetInstance()
void Mute(bool bMute=true)
Mute all notifications.
void Post(CRef< CEvent > evt, EDispatch disp_how=eDispatch_Default, int pool_name=ePool_Default)
Handles an event asynchronously (process and/or dispatch).
#define END_EVENT_MAP()
Ends definition of Command Map.
#define BEGIN_EVENT_MAP(thisClass, baseClass)
Begins definition of Command Map for CEventHandler-derived class.
virtual bool Send(CEvent *evt, EDispatch disp_how=eDispatch_Default, int pool_name=ePool_Default)
Sends an event synchronously.
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
void Reset(void)
Reset reference object.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
time_t GetTimeT(void) const
Get time in time_t format.
@ eCurrent
Use current time. See also CCurrentTime.
Multi-threading â mutexes; rw-locks; semaphore.
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