cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
osaMutex.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): Anton Deguet
7  Created on: 2008-01-30
8 
9  (C) Copyright 2004-2012 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 
28 #ifndef _osaMutex_h
29 #define _osaMutex_h
30 
34 
35 struct osaMutexInternals;
36 
49 
51  osaMutexInternals * Internals;
52 
54  osaThreadId LockerId;
55 
56  bool Locked;
57 
58 public:
59  /* Enum type representing a timeout period of infinity and no wait. */
60  enum TimeoutType {
61  WAIT_FOREVER = -1,
63  NO_WAIT = 0
65  };
66 
68 #if 0 // MJ: obsoleted
69  enum ReturnType {
70  LOCK_FAILED,
71  SUCCESS,
72  TIMED_OUT
73  };
74 #endif
75 
79  UNLOCKED
80  };
81 
83  osaMutex(void);
84 
86  ~osaMutex(void);
87 
93  void Lock(void);
94 
99  void Unlock(void);
100 
113  //ReturnType TryLock(int timeout);
114 
116  bool IsLocker(void) const;
117 
119  LockStateType GetLockState(void) const;
120 };
121 
122 
123 #endif // _osaMutex_h
124 
#define CISST_EXPORT
Definition: cmnExportMacros.h:50
Define a Mutex object.
Definition: osaMutex.h:48
Portability across compilers and operating systems tools.
Declaration of osaThread.
Definition: osaMutex.h:78
LockStateType
Definition: osaMutex.h:77
ThreadId type.
Definition: osaThread.h:77
Macros to export the symbols of cisstOSAbstraction (in a Dll).
TimeoutType
Definition: osaMutex.h:60
Definition: prmForwardDeclarations.h:40