http://www.sim.no/
http://www.coin3d.org/
include
Inventor
threads
SbMutex.h
1
#ifndef COIN_SBMUTEX_H
2
#define COIN_SBMUTEX_H
3
4
/**************************************************************************\
5
*
6
* This file is part of the Coin 3D visualization library.
7
* Copyright (C) by Kongsberg Oil & Gas Technologies.
8
*
9
* This library is free software; you can redistribute it and/or
10
* modify it under the terms of the GNU General Public License
11
* ("GPL") version 2 as published by the Free Software Foundation.
12
* See the file LICENSE.GPL at the root directory of this source
13
* distribution for additional information about the GNU GPL.
14
*
15
* For using Coin with software that can not be combined with the GNU
16
* GPL, and for taking advantage of the additional benefits of our
17
* support services, please contact Kongsberg Oil & Gas Technologies
18
* about acquiring a Coin Professional Edition License.
19
*
20
* See http://www.coin3d.org/ for more information.
21
*
22
* Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, NORWAY.
23
* http://www.sim.no/ sales@sim.no coin-support@coin3d.org
24
*
25
\**************************************************************************/
26
27
#include <Inventor/SbBasic.h>
28
#include <Inventor/C/threads/mutex.h>
29
30
class
SbMutex
{
31
public
:
32
SbMutex
(
void
) { this->mutex = cc_mutex_construct(); }
33
~SbMutex
() { cc_mutex_destruct(this->mutex); }
34
35
int
lock
(
void
) {
36
cc_mutex_lock(this->mutex);
37
/* Useless return, here just for compatibility with TGS'
38
SbThreadMutex API: */
39
return
0;
40
}
41
42
SbBool
tryLock
(
void
) {
43
return
cc_mutex_try_lock(this->mutex) == CC_OK;
44
}
45
46
int
unlock
(
void
) {
47
cc_mutex_unlock(this->mutex);
48
/* Useless return, here just for compatibility with TGS'
49
SbThreadMutex API: */
50
return
0;
51
}
52
53
private
:
54
// FIXME: we need access to C mutex structur. Should we use friend,
55
// or should we add a new public method to get to this structure?
56
// pederb, 2002-06-26
57
friend
class
SbCondVar
;
58
cc_mutex * mutex;
59
};
60
61
62
#ifndef COIN_INTERNAL
63
// For TGS Inventor compile-time compatibility.
64
#include <Inventor/threads/SbThreadAutoLock.h>
65
#endif // COIN_INTERNAL
66
67
#endif // !COIN_SBMUTEX_H
SbMutex::SbMutex
SbMutex(void)
Definition:
SbMutex.h:32
SbMutex::tryLock
SbBool tryLock(void)
Definition:
SbMutex.h:42
SbMutex::unlock
int unlock(void)
Definition:
SbMutex.h:46
SbMutex::lock
int lock(void)
Definition:
SbMutex.h:35
SbCondVar
A class for synchronizing access to global variables.
Definition:
SbCondVar.h:32
SbMutex::~SbMutex
~SbMutex()
Definition:
SbMutex.h:33
SbMutex
A basic class for managing a mutex.
Definition:
SbMutex.h:30
Copyright © 1998-2010 by
Kongsberg Oil & Gas Technologies
. All rights reserved.
Generated on Tue Jan 28 2020 for Coin by
Doxygen
1.8.17.