VR-Link API Documentation for HLA Evolved
vlThread.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 1992-2010 VT MAK
3 ** All rights reserved.
4 ******************************************************************************/
8 #pragma once
9 
10 #include "vlMachineTypes.h"
11 #include "vlThreadSysWrapper.h"
12 #include "vlMutex.h"
13 
14 #ifdef DtUSE_UTILITIES_NAMESPACE
15 namespace DtUSE_UTILITIES_NAMESPACE
16 {
17 #endif
18 
19 
20 
23 class DtRunnable;
24 
28 typedef void (*DtRunnableFunction)(void*,volatile bool*);
29 
35 {
36 public:
37  DtThreadStart(DtRunnable* runnable);
38  DtThreadStart(DtRunnableFunction function,void* data);
39 
41  void execute(volatile bool* stopFlag);
42 
44  void stop();
45 
46 protected:
50 };
51 
56 {
57 public:
58 
60  static DtThreadId GetCurrentThreadHandle();
61 
62 public:
65 
67  virtual ~DtThread();
68 
70  virtual DtThreadStatus start();
71 
73  DtThreadStatus startInCurrentThread();
74 
78  void stop(bool blocking);
79 
83  bool hasStarted() const;
84 
87  bool isRunning() const;
88 
90  DtThreadStatus join() const;
91 
93  DtThreadHandle threadId() const { return myThreadID; }
94 
95  void run();
96 
97 protected:
98 
101  bool stopped();
102 
105 
106 private:
108  DtThread(const DtThread& orig);
109  DtThread& operator=(const DtThread& orig);
110 
111 private:
113  volatile bool myTimeToStop;
114 
116  bool myRunning;
117 
121  mutable DtMutex myMutex;
122 };
123 
124 #ifdef DtUSE_UTILITIES_NAMESPACE
125 }
126 #endif
127 

Document ID: Generated on Wed Aug 14 15:35:11 EDT 2013 from SVN revision 130445
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)