NeoPZ
TPZReschedulableTask.cpp
Go to the documentation of this file.
1 #include "pzerror.h"
2 #include "TPZReschedulableTask.h"
3 #include <utility>
4 #include "TPZThreadPool.h"
5 #include "pzlog.h"
6 #include <mutex>
7 
8 #ifdef LOG4CXX
9 static LoggerPtr logger(Logger::getLogger("TPZThreadPool"));
10 #endif
11 
12 TPZReschedulableTask::TPZReschedulableTask(const int priority, TPZAutoPointer<std::packaged_task<void(void) >> task, TPZTaskGroup *taskGroup) :
13 TPZTask(priority, task, taskGroup) {
14 
15 }
16 
17 std::shared_future<void> TPZReschedulableTask::GetFuture() {
18  return mFuture;
19 }
20 
23 }
24 
26  bool executed = false;
27  {
28  std::unique_lock<std::mutex> lock(mStateMutex);
30  this->startInternal();
31  executed = true;
32  }
33  }
34  if (executed) {
35  mCondition.notify_all();
36  }
37 }
Contains definitions to LOGPZ_DEBUG, LOGPZ_INFO, LOGPZ_WARN, LOGPZ_ERROR and LOGPZ_FATAL, and the implementation of the inline InitializePZLOG(string) function using log4cxx library or not. It must to be called out of "#ifdef LOG4CXX" scope.
EProcessingState mState
Definition: TPZTask.h:39
Defines PZError.
std::shared_future< void > GetFuture()
TPZReschedulableTask(const int priority, TPZAutoPointer< std::packaged_task< void(void)>> task, TPZTaskGroup *taskGroup=NULL)
virtual void start()
Definition: TPZTask.cpp:27
Helper class for ordering the tasks that the user have requested.
Definition: TPZTask.h:18
std::shared_future< void > mFuture
std::condition_variable mCondition
This class implements a reference counter mechanism to administer a dynamically allocated object...