MAK RTIspy API Documentation for HLA 1516
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
vlThreadedObject.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2005 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 /******************************************************************************
6 ** $RCSfile: vlThreadedObject.h,v $ $Revision: 1.3 $ $State: Exp $
7 ******************************************************************************/
8 
12 
13 
14 #ifndef vlThreadedObject_H__
15 #define vlThreadedObject_H__
16 
17 #include "rtiMsConfig.h"
18 #include <vlutil/vlSmartPointers.h>
19 #include <vlutil/vlThread.h>
20 #include <vlutil/vlRunnable.h>
21 #include <vlutil/vlMutex.h>
22 #include <vlutil/vlExceptions.h>
23 #include <vlutil/vlMachineTypes.h>
24 
25 typedef std::shared_ptr<MAKRti::DtRunnable> DtRunnableSP;
26 
27 namespace vrlmod
28 {
29 
30 
31 
32 
33 
35 #define typedefException(Name,Value) \
36  const int Name##Number = Value;\
37  typedef MAKRti::DtTemplatedException<Name##Number> Name;
38 const int ThreadExceptionBase = 1000;
39 typedefException(DtThreadAlreadyRunning,ThreadExceptionBase + 1)
40 typedefException(DtThreadNotStarted, ThreadExceptionBase + 2)
41 typedefException(DtThreadCreationError, ThreadExceptionBase + 3)
42 typedefException(DtThreadWouldDeadlock, ThreadExceptionBase + 4)
43 
44 
46 {
47 public:
50  DtThreadedObject();
51 
54  DtThreadedObject(DtRunnableSP ptr);
55 
57  virtual ~DtThreadedObject();
58 
64  void start();
65 
68  void join();
69 
73  void stop(bool block);
74 
76  bool running() const;
77 
80  void setRunnableObject(DtRunnableSP newObject);
81 
83  DtRunnableSP runnableObject() const;
84 
85 protected:
86 
88  DtThreadedObject(const DtThreadedObject&);
89  DtThreadedObject& operator=(const DtThreadedObject&);
90 
92  void setRunning(bool value);
93 
96  MAKRti::DtThread* myThread;
97  mutable MAKRti::DtMutex myMutex;
98 };
99 
100 
101 
102 
103 }
104 
105 
106 
107 #endif
MAKRti::DtThread * myThread
Definition: vlThreadedObject.h:96
std::shared_ptr< MAKRti::DtRunnable > DtRunnableSP
Definition: vlThreadedObject.h:25
DtRunnableSP myObject
Definition: vlThreadedObject.h:95
const int ThreadExceptionBase
Definition: vlThreadedObject.h:38
#define DT_DLL_RTIUTIL
Definition: rtiMsConfig.h:160
bool myRunningFlag
Definition: vlThreadedObject.h:94
MAKRti::DtMutex myMutex
Definition: vlThreadedObject.h:97
#define typedefException(Name, Value)
Define a set of thread related exceptions.
Definition: vlThreadedObject.h:35
Definition: vlThreadedObject.h:45

Document ID: Generated on Wed Jul 8 16:20:32 EDT 2026 from SVN revision 291616
Copyright © 2005-2025 MAK Technologies Inc. All Rights Reserved (www.mak.com)