cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
osaThreadBuddy.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ex: set filetype=cpp softtabstop=4 shiftwidth=4 tabstop=4 cindent expandtab: */
3 
4 /*
5 
6  Author(s): Ankur Kapoor, Min Yang Jung
7  Created on: 2004-04-30
8 
9  (C) Copyright 2004-2010 Johns Hopkins University (JHU), All Rights
10  Reserved.
11 
12 --- begin cisst license - do not edit ---
13 
14 This software is provided "as is" under an open source license, with
15 no warranty. The complete license can be found in license.txt and
16 http://www.cisst.org/cisst/license.txt.
17 
18 --- end cisst license ---
19 */
20 
21 
27 #ifndef _osaThreadBuddy_h
28 #define _osaThreadBuddy_h
29 
33 
34 // Always include last
36 
41 CISST_EXPORT void __os_init(void);
42 
46 CISST_EXPORT void __os_exit(void);
47 
48 
49 struct osaThreadBuddyInternals;
50 
64 
65  osaThreadBuddyInternals* Data;
66 
68  double Period;
69 
70 public:
73 
75  ~osaThreadBuddy();
76 
86  void Create(const char *name, double period, int stack_size = 1024*256);
87  void Create(const char *name, const osaAbsoluteTime& tv, int stack_size = 1024*256 );
88 
90  void Delete();
91 
94  bool IsPeriodic() const { return Period > 0; }
95 
98  void WaitForPeriod(void);
99 
102  void WaitForRemainingPeriod(void);
103 
105  void MakeHardRealTime(void);
106 
108  void MakeSoftRealTime(void);
109 
111  void Resume(void);
112 
114  void Suspend(void);
115 
117  void LockStack();
118 
120  void UnlockStack();
121 };
122 
123 
124 #endif // _osaThreadBuddy_h
125 
#define CISST_EXPORT
Definition: cmnExportMacros.h:50
CISST_EXPORT void __os_exit(void)
Portability across compilers and operating systems tools.
Declaration of osaTimeServer class.
Declaration of osaThread.
CISST_EXPORT void __os_init(void)
Macros to export the symbols of cisstOSAbstraction (in a Dll).
bool IsPeriodic() const
Definition: osaThreadBuddy.h:94
Implementation of the Thread Proxy object in an OS independent manner.
Definition: osaThreadBuddy.h:63
Definition: osaTimeServer.h:36