21 #ifndef READ_WRITE_MONITOR_H 22 #define READ_WRITE_MONITOR_H 24 #ifndef SHEAF_DLL_SPEC_H 25 #include "SheafSystem/sheaf_dll_spec.h" 35 #ifndef STD_UNORDERED_MAP_H 36 #include "SheafSystem/std_unordered_map.h" 39 #include "SheafSystem/pthread.h" 42 #include "SheafSystem/any.h" 45 #include "SheafSystem/std_utility.h" 145 static bool access_control_disabled();
161 static void enable_access_control();
170 static bool& private_access_control_disabled();
184 bool is_read_accessible()
const;
190 bool is_not_read_accessible()
const;
195 bool is_read_write_accessible()
const;
200 bool is_not_read_write_accessible()
const;
205 bool is_read_only_accessible()
const;
210 bool is_not_read_only_accessible()
const;
215 int access_request_depth()
const;
220 void get_read_access()
const;
228 void get_read_write_access(
bool xrelease_read_only_access =
false);
234 void release_access(
bool xall =
false)
const;
241 bool access_guards_disabled()
const;
247 void disable_access_guards();
252 void enable_access_guards();
259 bool uncontrolled_is_read_write_accessible()
const;
264 bool uncontrolled_is_read_only_accessible()
const;
269 bool _access_guards_disabled;
285 struct SHEAF_DLL_SPEC thread_state_t
297 size_t _switch_depth;
313 mutable unordered::unordered_map<pthread_t, thread_state_t> _thread_state;
318 mutable pthread_cond_t lock_free;
323 mutable pthread_mutex_t read_write_monitor_mutex;
330 mutable thread_state_t _thread_state;
338 void initialize_thread_state();
343 bool contains_thread_state()
const;
348 thread_state_t& thread_state()
const;
353 int& access_mode()
const;
358 size_t& switch_depth()
const;
363 void request_read_only_access()
const;
368 void request_read_write_access()
const;
373 void release_read_only_access()
const;
378 void release_read_write_access()
const;
395 bool is_modified()
const;
400 void clear_is_modified();
425 bool is_mode_locked()
const;
435 int mode_lock_ct()
const;
445 void get_mode_lock();
455 void release_mode_lock();
479 virtual bool is_ancestor_of(
const any* xother)
const;
491 virtual bool invariant()
const;
504 #endif // ifndef READ_WRITE_MONITOR_H The monitor concurrency control interface. Class READ_WRITE_MONITOR implements the monitor concurrenc...
A handle for a hidden read_write_monitor state.
Abstract base class with useful features for all objects.
Namespace for the sheaves component of the sheaf system.