Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
Sync.h
Go to the documentation of this file.
1#pragma once
2
3#include "../global.h"
4#include "Exception.h"
5#include "Mutex.h"
6
7namespace sf
8{
9
57{
58 protected:
62 Sync() = default;
63
70 Sync(const Sync&) {}
71
78 {
79 return *this;
80 }
81
82 public:
86 class Lock : public Mutex::Lock
87 {
88 public:
92 inline explicit Lock(const Sync* sync, bool try_sync = false)
93 : Mutex::Lock(sync->_mutex, try_sync)
94 {}
95 };
96
97 private:
98 Mutex _mutex;
99};
100
101}// 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:87
Lock(const Sync *sync, bool try_sync=false)
Locks the Mutex object in the Sync object.
Definition Sync.h:92
Sync provides a system-independent interface to build classes that act like monitors,...
Definition Sync.h:57
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:70
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:77
Sync()=default
Only multi inheritance is allowed to create this instance.
#define _MISC_CLASS
Definition misc/global.h:35
Definition CodeEditor.h:8