YARP
Yet Another Robot Platform
Mutex.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 
6 #ifndef YARP_OS_MUTEX_H
7 #define YARP_OS_MUTEX_H
8 
9 #include <yarp/conf/system.h>
10 
11 #if !defined(YARP_INCLUDING_DEPRECATED_HEADER_ON_PURPOSE)
12 YARP_COMPILER_WARNING("<yarp/os/Mutex.h> file is deprecated")
13 #endif
14 
15 #ifndef YARP_NO_DEPRECATED // Since YARP 3.3
16 
17 #include <yarp/os/api.h>
18 #include <mutex>
19 
20 namespace yarp {
21 namespace os {
22 
31 class YARP_os_DEPRECATED_API_MSG("Use std::mutex instead") Mutex
32 {
33 public:
37  Mutex();
38 
42  ~Mutex();
43 
49  void lock();
50 
58  bool try_lock();
59 
65  void unlock();
66 
76  YARP_DEPRECATED_MSG("Use try_lock() instead")
77  bool tryLock();
78 
79 #ifndef DOXYGEN_SHOULD_SKIP_THIS
80 private:
81  class Private;
82  Private* mPriv;
83 #endif // DOXYGEN_SHOULD_SKIP_THIS
84 };
85 
86 } // namespace os
87 } // namespace yarp
88 
89 #endif // YARP_NO_DEPRECATED
90 
91 #endif // YARP_OS_MUTEX_H
Basic wrapper for mutual exclusion.
Definition: Mutex.h:32
#define YARP_DEPRECATED_MSG(MSG)
Expands to either the standard [[deprecated]] attribute or a compiler-specific decorator such as __at...
Definition: compiler.h:2885
The main, catch-all namespace for YARP.
Definition: dirs.h:16
#define YARP_COMPILER_WARNING(x)
Generate a warning at build time on supported compilers.
Definition: system.h:109
#define YARP_os_DEPRECATED_API_MSG(X)
Definition: api.h:21