YARP
Yet Another Robot Platform
Mutex.cpp
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#define YARP_INCLUDING_DEPRECATED_HEADER_ON_PURPOSE
7#include <yarp/os/Mutex.h>
8#undef YARP_INCLUDING_DEPRECATED_HEADER_ON_PURPOSE
9
12
13#include <mutex>
14
15using yarp::os::Mutex;
16
17class Mutex::Private : public std::mutex
18{
19};
20
21Mutex::Mutex() :
22 mPriv(new Private)
23{
24}
25
27{
28 delete mPriv;
29}
30
32{
33 mPriv->lock();
34}
35
37{
38 return mPriv->try_lock();
39}
40
42{
43 mPriv->unlock();
44}
45
47{
48 return mPriv->try_lock();
49}
50
Basic wrapper for mutual exclusion.
Definition: Mutex.h:31
void unlock()
Unlock the associated resource.
Definition: Mutex.cpp:41
bool try_lock()
Lock the associated resource if possible.
Definition: Mutex.cpp:36
bool tryLock()
Lock the associated resource if possible.
Definition: Mutex.cpp:46
~Mutex()
Destructor.
Definition: Mutex.cpp:26
void lock()
Lock the associated resource, waiting if necessary.
Definition: Mutex.cpp:31
#define YARP_WARNING_POP
Ends a temporary alteration of the enabled warnings.
Definition: system.h:334
#define YARP_WARNING_PUSH
Starts a temporary alteration of the enabled warnings.
Definition: system.h:333
#define YARP_DISABLE_DEPRECATED_WARNING
Disable deprecated warnings in the following code.
Definition: system.h:335