Beam-lib  2.16.3
This is the Beam C++ class library.
BSema.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * BSema.h BSema Classes
3  * T.Barnaby, BEAM Ltd, 6/11/02
4  * Copyright (c) 2012 All Right Reserved, Beam Ltd, http://www.beam.ltd.uk
5  *******************************************************************************
6  */
7 #ifndef BSEMA_H
8 #define BSEMA_H 1
9 
10 #include <sys/types.h>
11 #include <semaphore.h>
12 
14 class BSema {
15 public:
16  BSema(int value = 0);
17  BSema(const BSema& sema);
18  ~BSema();
19 
20  int post();
21  int wait();
22  int timedWait(int timeUs);
23  int tryWait();
24  int getValue() const;
25 
26  BSema& operator=(const BSema& sema);
27 private:
28  sem_t osema;
29 };
30 
31 #endif
Sempahore class.
Definition: BSema.h:14
int tryWait()
Test for the condition.
Definition: BSema.cpp:71
int getValue() const
Definition: BSema.cpp:75
BSema & operator=(const BSema &sema)
Definition: BSema.cpp:20
int timedWait(int timeUs)
Wait for condition with timeout.
Definition: BSema.cpp:48
BSema(int value=0)
Definition: BSema.cpp:12
~BSema()
Definition: BSema.cpp:26
int post()
Post condition.
Definition: BSema.cpp:30
int wait()
Wait for contition.
Definition: BSema.cpp:34