YARP
Yet Another Robot Platform
Semaphore.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2021 Istituto Italiano di Tecnologia (IIT)
3  * Copyright (C) 2006-2010 RobotCub Consortium
4  * All rights reserved.
5  *
6  * This software may be modified and distributed under the terms of the
7  * BSD-3-Clause license. See the accompanying LICENSE file for details.
8  */
9 
10 #ifndef YARP_OS_SEMAPHORE_H
11 #define YARP_OS_SEMAPHORE_H
12 
13 #include <yarp/os/api.h>
14 
15 namespace yarp {
16 namespace os {
17 
29 {
30 public:
35  Semaphore(unsigned int initialCount = 1);
36 
40  virtual ~Semaphore();
41 
47  void wait();
48 
49 
60  bool waitWithTimeout(double timeoutInSeconds);
61 
62 
69  bool check();
70 
75  void post();
76 
77 #ifndef DOXYGEN_SHOULD_SKIP_THIS
78 private:
79  class Private;
80  Private* mPriv;
81 #endif // DOXYGEN_SHOULD_SKIP_THIS
82 };
83 
84 } // namespace os
85 } // namespace yarp
86 
87 #endif // YARP_OS_SEMAPHORE_H
A class for thread synchronization and mutual exclusion.
Definition: Semaphore.h:29
The main, catch-all namespace for YARP.
Definition: dirs.h:19
#define YARP_os_API
Definition: api.h:21