cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
osaCriticalSection.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): Balazs Vagvolgyi, Min Yang Jung
7  Created on: 2008
8 
9  (C) Copyright 2006-2011 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 
22 #ifndef _osaCriticalSection_h
23 #define _osaCriticalSection_h
24 
25 
27 
28 #if (CISST_OS == CISST_LINUX_RTAI) || (CISST_OS == CISST_LINUX) || (CISST_OS == CISST_DARWIN) || (CISST_OS == CISST_SOLARIS) || (CISST_OS == CISST_QNX) || (CISST_OS == CISST_LINUX_XENOMAI)
30 #endif
31 
32 
33 // Always include last
35 
37 {
38  friend class osaMutexTest;
39 
40 #if (CISST_OS == CISST_WINDOWS)
41  // for Windows only, hide critical section handle in internals
42  enum {INTERNALS_SIZE = 64};
43  char Internals[INTERNALS_SIZE];
44 #endif
45 #if (CISST_OS == CISST_LINUX_RTAI) || (CISST_OS == CISST_LINUX) || (CISST_OS == CISST_DARWIN) || (CISST_OS == CISST_SOLARIS) || (CISST_OS == CISST_QNX) || (CISST_OS == CISST_LINUX_XENOMAI)
46  enum {INTERNALS_SIZE = 0};
47  osaMutex Mutex;
48 #endif
49 
52  static unsigned int SizeOfInternals(void);
53 
54  public:
57 
58  bool TryEnter(void);
59  void Enter(void);
60  void Leave(void);
61 };
62 
63 #endif // _osaCriticalSection_h
#define CISST_EXPORT
Definition: cmnExportMacros.h:50
Declaration of osaMutex.
Define a Mutex object.
Definition: osaMutex.h:48
Portability across compilers and operating systems tools.
Definition: osaCriticalSection.h:36
Macros to export the symbols of cisstOSAbstraction (in a Dll).