Line |
Branch |
Exec |
Source |
1 |
|
|
/** |
2 |
|
|
* @file api.Mutex.hpp |
3 |
|
|
* @author Sergey Baigudin, sergey@baigudin.software |
4 |
|
|
* @copyright 2015-2022, Sergey Baigudin, Baigudin Software |
5 |
|
|
*/ |
6 |
|
|
#ifndef API_MUTEX_HPP_ |
7 |
|
|
#define API_MUTEX_HPP_ |
8 |
|
|
|
9 |
|
|
#include "api.Object.hpp" |
10 |
|
|
|
11 |
|
|
namespace eoos |
12 |
|
|
{ |
13 |
|
|
namespace api |
14 |
|
|
{ |
15 |
|
|
|
16 |
|
|
/** |
17 |
|
|
* @class Mutex |
18 |
|
|
* @brief Mutex interface. |
19 |
|
|
*/ |
20 |
|
|
class Mutex : public Object |
21 |
|
|
{ |
22 |
|
|
|
23 |
|
|
public: |
24 |
|
|
|
25 |
|
|
/** |
26 |
|
|
* @brief Destructor. |
27 |
|
|
*/ |
28 |
|
|
virtual ~Mutex() = 0; |
29 |
|
|
|
30 |
|
|
/** |
31 |
|
|
* @brief Tries to locks this mutex. |
32 |
|
|
* |
33 |
|
|
* @return True if this mutex is locked successfully, or false if other thread locked on this mutex. |
34 |
|
|
*/ |
35 |
|
|
virtual bool_t tryLock() = 0; |
36 |
|
|
|
37 |
|
|
/** |
38 |
|
|
* @brief Locks this mutex. |
39 |
|
|
* |
40 |
|
|
* @return True if this mutex is locked successfully, or false if an error occurred. |
41 |
|
|
*/ |
42 |
|
|
virtual bool_t lock() = 0; |
43 |
|
|
|
44 |
|
|
/** |
45 |
|
|
* @brief Unlocks this mutex. |
46 |
|
|
*/ |
47 |
|
|
virtual void unlock() = 0; |
48 |
|
|
|
49 |
|
|
}; |
50 |
|
|
|
51 |
|
248 |
inline Mutex::~Mutex() {} |
52 |
|
|
|
53 |
|
|
} // namespace api |
54 |
|
|
} // namespace eoos |
55 |
|
|
#endif // API_MUTEX_HPP_ |
56 |
|
|
|