Coin Logo http://www.sim.no/
http://www.coin3d.org/

SbCondVar.h
1 #ifndef COIN_SBCONDVAR_H
2 #define COIN_SBCONDVAR_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/SbTime.h>
29 #include <Inventor/C/threads/condvar.h>
30 #include <Inventor/threads/SbMutex.h>
31 
32 class SbCondVar {
33 public:
34  SbCondVar(void) { this->condvar = cc_condvar_construct(); }
35  ~SbCondVar(void) { cc_condvar_destruct(this->condvar); }
36 
37  SbBool wait(SbMutex & mutex) {
38  return cc_condvar_wait(this->condvar, mutex.mutex) == CC_OK;
39  }
40  SbBool timedWait(SbMutex & mutex, SbTime period) {
41  return cc_condvar_timed_wait(this->condvar, mutex.mutex, period.getValue()) == CC_OK;
42  }
43 
44  void wakeOne(void) { cc_condvar_wake_one(this->condvar); }
45  void wakeAll(void) { cc_condvar_wake_all(this->condvar); }
46 
47 private:
48  cc_condvar * condvar;
49 };
50 
51 #endif // !COIN_SBCONDVAR_H
A basic class for managing a mutex.This class provides a portable framework around the mutex interfac...
Definition: SbMutex.h:30
double getValue(void) const
Definition: SbTime.cpp:278
void wakeOne(void)
Definition: SbCondVar.h:44
SbBool timedWait(SbMutex &mutex, SbTime period)
Definition: SbCondVar.h:40
A class for synchronizing access to global variables.Condition variables are used to protect global v...
Definition: SbCondVar.h:32
SbBool wait(SbMutex &mutex)
Definition: SbCondVar.h:37
~SbCondVar(void)
Definition: SbCondVar.h:35
The SbTime class instances represents time values.SbTime is a convenient way of doing system independ...
Definition: SbTime.h:41
void wakeAll(void)
Definition: SbCondVar.h:45
SbCondVar(void)
Definition: SbCondVar.h:34

Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.

Generated on Fri Sep 9 2016 for Coin by Doxygen 1.8.5.