Beamlib  3.0.1
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) 2022 All Right Reserved, Beam Ltd, https://www.beam.ltd.uk
5  * For license see LICENSE.txt at the root of the beamlib source tree.
6  *******************************************************************************
7  */
8 #ifndef BSEMA_H
9 #define BSEMA_H 1
10 
11 #include <sys/types.h>
12 #include <semaphore.h>
13 
15 class BSema {
16 public:
17  BSema(int value = 0);
18  BSema(const BSema& sema);
19  ~BSema();
20 
21  int post();
22  int wait();
23  int timedWait(int timeUs);
24  int tryWait();
25  int getValue() const;
26 
27  BSema& operator=(const BSema& sema);
28 private:
29  sem_t osema;
30 };
31 
32 #endif
Sempahore class.
Definition: BSema.h:15
int getValue() const
Definition: BSema.cpp:75
~BSema()
Definition: BSema.cpp:26
BSema & operator=(const BSema &sema)
Definition: BSema.cpp:20
BSema(int value=0)
Definition: BSema.cpp:12
int post()
Post condition.
Definition: BSema.cpp:30
int wait()
Wait for contition.
Definition: BSema.cpp:34
int timedWait(int timeUs)
Wait for condition with timeout.
Definition: BSema.cpp:48
int tryWait()
Test for the condition.
Definition: BSema.cpp:71