PLCnext API Documentation  20.6.0.30321
Mutex.hpp
1 //
3 // Copyright PHOENIX CONTACT Electronics GmbH
4 //
6 #pragma once
7 #include "Arp/System/Core/Arp.h"
8 
9 // forwards
10 namespace Arp { namespace System { namespace Ve
11 {
12 class IMutexService;
13 }}}
14 
15 namespace Arp { namespace System { namespace Commons { namespace Threading
16 {
17 
18 // Forward declaration for friend class usage.
19 class ConditionVariable;
20 
25 class Mutex
26 {
27  friend class ConditionVariable;
28 
29 public: // construction/destruction
31  Mutex(bool recursive = true);
32 
34  Mutex(Mutex&& arg);
35 
37  virtual ~Mutex(void);
38 
39 public: // operations
43  void Lock(void);
44 
46  void Unlock(void);
47 
50  bool TryLock(void);
51 
52 private: // deleted methods
53  Mutex(const Mutex& arg) = delete;
54  Mutex& operator=(const Mutex& arg) = delete;
55 
56 private: // usings/typedefs
57  using IMutexService = Arp::System::Ve::IMutexService;
58 
59 private: // fields
60  Arp::System::Ve::IMutexService* pMutexService;
61 };
62 
64 // inline methods of class Mutex
65 
66 }}}} // end of namespace Arp::System::Commons::Threading
Mutual exclusion object to prevent data from concurrent modifications.
Definition: Mutex.hpp:25
Root namespace for the PLCnext API
System components used by the System, Device, Plc or Io domains.