本文整理汇总了C++中ITask::Run方法的典型用法代码示例。如果您正苦于以下问题:C++ ITask::Run方法的具体用法?C++ ITask::Run怎么用?C++ ITask::Run使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITask
的用法示例。
在下文中一共展示了ITask::Run方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Run
unsigned Thread::Run()
{
DebugLog << "Thread::Run" << std::endl;
while (true)
{
if (mpThreadPool == NULL)
{
DebugLog << "mpThreadPool == NULL" << std::endl;
}
ITask* pTask = mpThreadPool->GetTask();
if (pTask != NULL)
{
DebugLog << "Get a valid task" << std::endl;
if (pTask->GetType() == TP_Exit)
{
pTask->OnComplete();
mpThreadPool->FinishATask();
break;
}
else if (pTask->GetType() == TP_Normal)
{
pTask->Run();
pTask->OnComplete();
mpThreadPool->FinishATask();
}
}
else
{
DebugLog << "Get an invalid task" << std::endl;
}
}
return 0;
}
示例2: Run
void Worker::Run() {
while (!_Shutdown) {
ITask* currentJob = _Q->FetchTask();
if (currentJob != NULL) {
currentJob->Run();
if (currentJob->ToBeDisposedByWorker()) {
delete currentJob;
}
}
}
}
示例3: run
void QueueRunnable::run()
{
while (queue->IsStarted()) {
queue->LockQueue();
ITask* task = queue->NextTask();
if (task == NULL) {
queue->UnlockQueue();
continue;
}
currentTask = task;
queue->UnlockQueue();
task->Run();
queue->LockQueue();
currentTask = NULL;
queue->FinishTask(task);
queue->NotifyQueue();
queue->UnlockQueue();
}
}
示例4: PopAndExecuteTask
void ThreadPoolImpl::PopAndExecuteTask()
{
ITask* currentTask = nullptr;
mutex_.Lock();
if(!tasks_.empty())
{
currentTask = tasks_.front();
tasks_.pop();
}
mutex_.UnLock();
if (currentTask)
{
currentTask->Run();
delete currentTask;
}
}
示例5: Activate
//---------------------------------------------------------------------------
void TTaskScheduler::Execute(wstring taskName){
ITask *pITask = Activate(taskName);
if(pITask == NULL){
return;
}
///////////////////////////////////////////////////////////////////
// Call ITask::Run to start execution of "Test Task".
///////////////////////////////////////////////////////////////////
HRESULT hr = pITask->Run();
if (FAILED(hr)){
sprintf(lastError, "Failed calling ITask::Run, error = 0x%x\n", hr);
return;
}
pITask->Release();
}
示例6: RunTask
void NObjCommonBfTaskProfile::RunTask( DRI::IAsyncCmd *pAsyncCmd, ITask& task, const Domain::ObjectName& taskName, NObjBroadcastReceiver* postValidator)
{
if (pAsyncCmd)
{
AsyncBegin(pAsyncCmd, boost::bind(&NObjCommonBfTaskProfile::AbortAsync, this));
}
else
{
// это не первая задача
ESS_ASSERT(AsyncActive());
}
m_postValidator = postValidator;
m_taskLog.reset(getDomain().LogCreator()->CreateSession(taskName.Name().toStdString(), m_traceClient));
*m_taskLog << "RunTask" << iLogW::EndRecord;
QString msg;
msg += "Task ";
msg += taskName.Name();
msg += " started...";
Log(msg);
try
{
bool runAsLastTask;
task.Run(runAsLastTask);
if (!runAsLastTask) m_pNetTask = &task;
else m_pNetTask = 0;
}
catch(const ESS::BaseException& e)
{
AsyncComplete(false, e.getTextMessage().c_str());
}
}