一呼百應, "one call, a hundred responses"
Loading...
Searching...
No Matches
thread_safety.hpp
Go to the documentation of this file.
1#pragma once
2
13#include "common.hpp"
14
23
32#if ein_has_attribute(no_thread_safety_analysis)
33 #define ein_no_thread_safety_analysis __attribute__((no_thread_safety_analysis))
34#else
35 #define ein_no_thread_safety_analysis
36#endif
37
46#if ein_has_attribute(lockable)
47 #define ein_lockable __attribute__((lockable))
48#else
49 #define ein_lockable
50#endif
51
61#if ein_has_attribute(scoped_lockable)
62 #define ein_scoped_lockable __attribute__((scoped_lockable))
63#else
64 #define ein_scoped_lockable
65#endif
66
74#if ein_has_attribute(guarded_var)
75 #define ein_guarded_var __attribute__((guarded_var))
76#else
77 #define ein_guarded_var
78#endif
79
87#if ein_has_attribute(pt_guarded_var)
88 #define ein_pt_guarded_var __attribute__((pt_guarded_var))
89#else
90 #define ein_pt_guarded_var
91#endif
92
100#if ein_has_attribute(guarded_by)
101 #define ein_guarded_by(x) __attribute__((guarded_by(x)))
102#else
103 #define ein_guarded_by(x)
104#endif
105
113#if ein_has_attribute(pt_guarded_by)
114 #define ein_pt_guarded_by(x) __attribute__((pt_guarded_by(x)))
115#else
116 #define ein_pt_guarded_by(x)
117#endif
118
128#if ein_has_attribute(acquired_before)
129 #define ein_acquired_before(...) __attribute__((acquired_before(__VA_ARGS__)))
130#else
131 #define ein_acquired_before(...)
132#endif
133
143#if ein_has_attribute(acquired_after)
144 #define ein_acquired_after(...) __attribute__((acquired_after(__VA_ARGS__)))
145#else
146 #define ein_acquired_after(...)
147#endif
148
160#if ein_has_attribute(exclusive_lock_function)
161 #define ein_exclusive_lock_function(...) __attribute__((exclusive_lock_function(__VA_ARGS__)))
162#else
163 #define ein_exclusive_lock_function(...)
164#endif
165
180#if ein_has_attribute(shared_trylock_function)
181 #define ein_shared_trylock_function(...) __attribute__((shared_trylock_function(__VA_ARGS__)))
182#else
183 #define ein_shared_trylock_function(...)
184#endif
185
196#if ein_has_attribute(unlock_function)
197 #define ein_unlock_function(...) __attribute__((unlock_function(__VA_ARGS__)))
198#else
199 #define ein_unlock_function(...)
200#endif
201
211#if ein_has_attribute(lock_returned)
212 #define ein_lock_returned(__x) __attribute__((lock_returned(__x)))
213#else
214 #define ein_lock_returned(__x)
215#endif
216
225#if ein_has_attribute(locks_excluded)
226 #define ein_locks_excluded(...) __attribute__((locks_excluded(__VA_ARGS__)))
227#else
228 #define ein_locks_excluded(...)
229#endif
230
239#if ein_has_attribute(exclusive_locks_required)
240 #define ein_exclusive_locks_required(...) __attribute__((exclusive_locks_required(__VA_ARGS__)))
241#else
242 #define ein_exclusive_locks_required(...)
243#endif
244
253#if ein_has_attribute(shared_locks_required)
254 #define ein_shared_locks_required(...) __attribute__((shared_locks_required(__VA_ARGS__)))
255#else
256 #define ein_shared_locks_required(...)
257#endif
258