cisst-saw
Toggle main menu visibility
Loading...
Searching...
No Matches
tmp
cisst-saw
cisst
cisstOSAbstraction
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
26
#include <
cisstCommon/cmnPortability.h
>
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)
29
#include <
cisstOSAbstraction/osaMutex.h
>
30
#endif
31
32
33
// Always include last
34
#include <
cisstOSAbstraction/osaExport.h
>
35
36
class
CISST_EXPORT
osaCriticalSection
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
:
55
osaCriticalSection
();
56
~osaCriticalSection
();
57
58
bool
TryEnter
(
void
);
59
void
Enter
(
void
);
60
void
Leave
(
void
);
61
};
62
63
#endif
// _osaCriticalSection_h
osaCriticalSection::Enter
void Enter(void)
osaCriticalSection::~osaCriticalSection
~osaCriticalSection()
osaCriticalSection::Leave
void Leave(void)
osaCriticalSection::osaMutexTest
friend class osaMutexTest
Definition
osaCriticalSection.h:38
osaCriticalSection::TryEnter
bool TryEnter(void)
osaCriticalSection::osaCriticalSection
osaCriticalSection()
CISST_EXPORT
#define CISST_EXPORT
Definition
cmnExportMacros.h:50
cmnPortability.h
Portability across compilers and operating systems tools.
osaExport.h
Macros to export the symbols of cisstOSAbstraction (in a Dll).
osaMutex.h
Declaration of osaMutex.
Generated by
1.18.0