Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
Sync.h
Go to the documentation of this file.
1#pragma once
3#include <misc/gen/Mutex.h>
4#include <misc/global.h>
5
6namespace sf
7{
8
56{
57 protected:
61 Sync() = default;
62
69 Sync(const Sync&) {}
70
77 {
78 return *this;
79 }
80
81 public:
85 class Lock : public Mutex::Lock
86 {
87 public:
91 inline explicit Lock(const Sync* sync, bool try_sync = false)
92 : Mutex::Lock(sync->_mutex, try_sync)
93 {}
94 };
95
96 private:
97 Mutex _mutex;
98};
99
100}// namespace sf
Locking class for easy locking and unlocking by destructor.
Definition Mutex.h:43
Lightweight intra process thread synchronization.
Definition Mutex.h:17
Locks the Mutex object in the Sync object.
Definition Sync.h:86
Lock(const Sync *sync, bool try_sync=false)
Locks the Mutex object in the Sync object.
Definition Sync.h:91
Sync provides a system-independent interface to build classes that act like monitors,...
Definition Sync.h:56
Sync(const Sync &)
Copy constructor does not copy the Mutex object, since the new object is not being used in any of its...
Definition Sync.h:69
Sync & operator=(const Sync &)
Does not copy the Mutex object, since the new object is not being used in any of its own member funct...
Definition Sync.h:76
Sync()=default
Only multi inheritance is allowed to create this instance.
#define _MISC_CLASS
Definition misc/global.h:40
Definition Application.h:10