OpenDaVINCI  4.15.3
POSIXThread.h
Go to the documentation of this file.
1 
20 #ifndef OPENDAVINCI_CORE_WRAPPER_POSIX_POSIXTHREAD_H_
21 #define OPENDAVINCI_CORE_WRAPPER_POSIX_POSIXTHREAD_H_
22 
23 #include <pthread.h>
24 #include <memory>
25 
28 
29 namespace odcore { namespace wrapper { class Mutex; } }
30 namespace odcore { namespace wrapper { class Runnable; } }
31 namespace odcore { namespace wrapper { template <odcore::wrapper::SystemLibraryProducts product> class ConcurrencyFactoryWorker; } }
32 
33 namespace odcore {
34  namespace wrapper {
35  namespace POSIX {
36 
37  using namespace std;
38 
45  class POSIXThread : public Thread {
46  private:
48 
55 
56  private:
57  enum THREAD_STATE {
58  INITIALIZED,
59  RUNNING,
60  STOPPED
61  };
62 
63  private:
69  POSIXThread(const POSIXThread &);
70 
76  POSIXThread& operator=(const POSIXThread &);
77 
78  public:
79  virtual ~POSIXThread();
80 
81  virtual bool start();
82 
83  virtual bool stop();
84 
85  virtual bool isRunning() const;
86 
87  private:
88  unique_ptr<Mutex> m_threadStateMutex;
89  THREAD_STATE m_threadState;
90 
91  Runnable &m_runnable;
92 
93  pthread_t m_threadWrapper;
94  };
95 
96  }
97  }
98 } // odcore::wrapper::POSIX
99 
100 #endif /*OPENDAVINCI_CORE_WRAPPER_POSIX_POSIXTHREAD_H_*/
Definition: ConcurrencyFactoryWorker.h:42
Definition: Runnable.h:35
Definition: POSIXThread.h:45
Definition: base/Thread.h:34
Definition: SystemLibraryProducts.h:28