NeoPZ
TPZReschedulableTask.h
Go to the documentation of this file.
1 #ifndef TPZRESCHEDULABLETASK_H
2 #define TPZRESCHEDULABLETASK_H
3 
4 #include <future>
5 #include <mutex>
6 #include "TPZTask.h"
7 
8 class TPZReschedulableTask : public TPZTask {
9 public:
10  friend class TPZThreadPool;
11 
12  std::shared_future<void> GetFuture();
13 
14 
15 protected:
16  TPZReschedulableTask(const int priority, TPZAutoPointer<std::packaged_task<void(void)>> task, TPZTaskGroup *taskGroup = NULL);
17 
18  // Should be called in a thread-safe context
19  virtual void startInternal();
20 
21  virtual void start();
22 
24 private:
25 
26 
27  std::shared_future<void> mFuture;
28  std::condition_variable mCondition;
29 };
30 
31 #endif // TPZRESCHEDULABLETASK_H
pthread_mutex_t mutex
Semaphore which controls multiple threads.
Administers tasks that will be executed asynchronously.
Definition: TPZThreadPool.h:23
std::shared_future< void > GetFuture()
TPZReschedulableTask(const int priority, TPZAutoPointer< std::packaged_task< void(void)>> task, TPZTaskGroup *taskGroup=NULL)
Helper class for ordering the tasks that the user have requested.
Definition: TPZTask.h:18
std::shared_future< void > mFuture
std::condition_variable mCondition
int priority() const
Definition: TPZTask.cpp:23
This class implements a reference counter mechanism to administer a dynamically allocated object...