Debian Codegraph @

avogadro/core/mutex.h

raw
1 /******************************************************************************
2 This source file is part of the Avogadro project.
3 This source code is released under the 3-Clause BSD License, (see "LICENSE").
4 ******************************************************************************/
5
6 #ifndef AVOGADRO_CORE_MUTEX_H
7 #define AVOGADRO_CORE_MUTEX_H
8
9 #include "avogadrocoreexport.h"
10
11 namespace Avogadro::Core {
12
13 /**
14 * @class Mutex mutex.h <avogadro/core/mutex.h>
15 * @brief The Mutex class provides a simple wrapper for the C++11 mutex
16 * class
17 * @author Marcus D. Hanwell
18 *
19 * A very simple, and thin wrapper around the C++11 mutex class, allowing for
20 * lock, tryLock and unlock.
21 */
22
23 class AVOGADROCORE_EXPORT Mutex
24 {
25 public:
26 Mutex();
27 ~Mutex();
28
29 /**
30 * @brief Obtain an exclusive lock.
31 */
32 void lock();
33
34 /**
35 * @brief Attempt to obtain an exclusive lock.
36 * @return True on success, false on failure.
37 */
38 bool tryLock();
39
40 /**
41 * @brief Unlocks the lock.
42 */
43 void unlock();
44
45 private:
46 class PIMPL;
47 PIMPL* d;
48 };
49 } // end namespace Avogadro::Core
50
51 #endif // AVOGADRO_CORE_MUTEX_H