DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
RobustMutex.hpp
Go to the documentation of this file.
1
2#ifndef _uhal_ipc_RobustMutex_hpp_
3#define _uhal_ipc_RobustMutex_hpp_
4
5#include <cstdint>
6
7#include "uhal/ClientInterface.hpp"
8#include "uhal/log/exception.hpp"
9
10namespace uhallibs {
11namespace ipc {
12
13namespace exception {
15UHAL_DEFINE_DERIVED_EXCEPTION_CLASS(MutexError,
16 uhal::exception::TransportLayerError,
17 "Exception class to handle errors from pthread mutex-related functions.")
18} // namespace exception
19
21{
22public:
25
26 void lock();
27
28 void unlock();
29
30 uint64_t getCounter() const;
31
32 bool isActive() const;
33
34 void startSession();
35
36 void endSession();
37
38private:
40
41 pthread_mutex_t mMutex;
42 uint64_t mCount;
44};
45
46} // namespace ipc
47} // namespace uhal
48
49#endif /* _uhal_ipc_RobustMutex_hpp_ */
uint64_t getCounter() const
RobustMutex(const RobustMutex &)