All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Thread.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Types.h"
6 #include "IRunnable.h"
7 #include "IThreadService.h"
8 #include <pthread.h>
9 
10 namespace Eegeo
11 {
12  namespace Concurrency
13  {
14  class Thread : protected Eegeo::NonCopyable
15  {
16  public:
17  Thread(IRunnable& runnable, IThreadService& threadService);
18  virtual ~Thread();
19 
20  bool Start();
21  void WaitForStop();
22  bool IsRunning() const;
23 
24  private:
25  IRunnable& m_runnable;
26  IThreadService& m_threadService;
27  IThreadService::ThreadID m_thread;
28 
29  static void* Run(void* pObj);
30 
31  bool m_isRunning;
32 
33  IRunnable& GetRunnable() const;
34  };
35  }
36 }