Evo C++ Library v0.5.1
thread_inert.h
Go to the documentation of this file.
1 // Evo C++ Library
2 /* Copyright 2019 Justin Crowell
3 Distributed under the BSD 2-Clause License -- see included file LICENSE.txt for details.
4 */
6 
7 #pragma once
8 #ifndef INCL_evo_thread_inert_h
9 #define INCL_evo_thread_inert_h
10 
11 #include "impl/sys.h"
12 
13 namespace evo {
16 
18 
26 template<class T>
30  { }
31 
33  SmartLockInert(T&, bool)
34  { }
35 
37  SmartLockInert(T&, ulong)
38  { }
39 
44  { return *this; }
45 
51  { return *this; }
52 
57  { return *this; }
58 };
59 
61 
67 struct MutexInert {
72 
76  bool trylock()
77  { return true; }
78 
80  void lock()
81  { }
82 
86  void sleeplock(ulong)
87  { }
88 
90  void unlock()
91  { }
92 
96  bool trylock_read()
97  { return true; }
98 
100  void lock_read()
101  { }
102 
104  void unlock_read()
105  { }
106 };
107 
109 }
111 #endif
SmartLockInert< MutexInert > Lock
Lock object type (inert) – see SmartLockInert.
Definition: thread_inert.h:68
SmartLockInert & unlock()
Unlock object (no-op).
Definition: thread_inert.h:56
Inert mutex used to disable thread synchronization.
Definition: thread_inert.h:67
SmartLockInert & lock(ulong)
Lock object (no-op).
Definition: thread_inert.h:50
bool trylock_read()
Try to read-lock (no-op).
Definition: thread_inert.h:96
void sleeplock(ulong)
Lock object (no-op).
Definition: thread_inert.h:86
Evo implementation detail for system portability – this is included by most Evo headers, include this via: include <evo/type.h>.
void lock_read()
Read-lock object (no-op).
Definition: thread_inert.h:100
SmartLockInert(T &, ulong)
Constructor – args are ignored.
Definition: thread_inert.h:37
Inert lock that doesn&#39;t do anything.
Definition: thread_inert.h:27
SmartLockInert< MutexInert > SleepLock
Sleep-Lock object type (inert) – see SmartLockInert.
Definition: thread_inert.h:71
void unlock_read()
Un-read-lock object (no-op).
Definition: thread_inert.h:104
void lock()
Lock object (no-op).
Definition: thread_inert.h:80
Evo C++ Library namespace.
Definition: alg.h:11
SmartLockInert< MutexInert > LockRead
Read Lock object type (inert) – see SmartLockInert.
Definition: thread_inert.h:70
SmartLockInert< MutexInert > LockWrite
Write Lock object type (inert) – see SmartLockInert.
Definition: thread_inert.h:69
void unlock()
Unlock object (no-op).
Definition: thread_inert.h:90
SmartLockInert(T &, bool)
Constructor – args are ignored.
Definition: thread_inert.h:33
bool trylock()
Try to lock (no-op).
Definition: thread_inert.h:76
SmartLockInert(T &)
Constructor – arg is ignored.
Definition: thread_inert.h:29
SmartLockInert & lock()
Lock object (no-op).
Definition: thread_inert.h:43