VR-Link API Documentation for DIS
Home
Namespaces
Classes
Files
Examples
Libraries
File List
File Members
include
vlutil
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
#include "
vlSmartPointers.h
"
14
15
#ifdef DtUSE_UTILITIES_NAMESPACE
16
namespace
DtUSE_UTILITIES_NAMESPACE
17
{
18
#endif
19
20
21
24
class
DtRunnable
;
25
29
typedef
void (*
DtRunnableFunction
)(
void
*,
volatile
bool
*);
30
35
class
DT_DLL_VLUTIL
DtThreadStart
36
{
37
public
:
38
DtThreadStart
(
DtRunnable
* runnable);
39
DtThreadStart
(
DtRunnableFunction
function
,
void
* data);
40
42
void
execute(
volatile
bool
* stopFlag);
43
45
void
stop();
46
47
protected
:
48
DtRunnable
*
myRunnableObject
;
49
DtRunnableFunction
myRunnableFunction
;
50
void
*
myInitializationData
;
51
};
52
53
typedef
DtBoost::shared_ptr<DtThreadStart>
DtThreadStartSP
;
54
58
class
DT_DLL_VLUTIL
DtThread
59
{
60
public
:
61
63
static
DtThreadId
GetCurrentThreadHandle();
64
65
public
:
67
DtThread
(
DtThreadStartSP
threadStart);
68
70
virtual
~
DtThread
();
71
73
virtual
DtThreadStatus
start();
74
76
DtThreadStatus
startInCurrentThread();
77
81
void
stop(
bool
blocking);
82
86
bool
hasStarted()
const
;
87
90
bool
isRunning()
const
;
91
93
DtThreadStatus
join()
const
;
94
96
DtThreadHandle
threadId
()
const
{
return
myThreadID; }
97
98
void
run();
99
100
protected
:
101
104
bool
stopped();
105
107
DtThreadHandle
myThreadID
;
108
109
private
:
111
DtThread
(
const
DtThread
& orig);
112
DtThread
& operator=(
const
DtThread
& orig);
113
114
private
:
116
volatile
bool
myTimeToStop
;
117
119
bool
myRunning
;
120
121
DtThreadStartSP
myThreadStart
;
122
125
mutable
DtMutex
myMutex
;
126
};
127
128
#ifdef DtUSE_UTILITIES_NAMESPACE
129
}
130
#endif
131
Document ID: Generated on Wed Oct 23 22:25:48 EDT 2013 from SVN revision 132765
Copyright © 2005-2013 VT MÄK. All Rights Reserved (
www.mak.com
)