25 #ifndef INCLUDED_AsyncAccessControl_h_GUID_4255BCEE_826C_4DB4_9368_9457ADBF9456 26 #define INCLUDED_AsyncAccessControl_h_GUID_4255BCEE_826C_4DB4_9368_9457ADBF9456 32 #include <boost/noncopyable.hpp> 33 #include <boost/thread.hpp> 34 #include <boost/optional/optional.hpp> 40 namespace connection {
74 enum MainThreadMessages {
81 typedef boost::recursive_mutex MainMutexType;
82 typedef boost::unique_lock<MainMutexType> MainLockType;
96 bool m_handleRTS(MainLockType &lock, MainThreadMessages response,
97 MainThreadMessages postCompletionState = MTM_WAIT);
101 typedef boost::mutex DoneMutexType;
102 typedef boost::unique_lock<DoneMutexType> DoneLockType;
103 DoneMutexType m_mutDone;
105 boost::optional<boost::thread::id> m_currentRequestThread;
109 boost::condition_variable m_condMainThread;
112 boost::condition_variable_any m_condAsyncThread;
117 volatile bool m_done;
119 volatile MainThreadMessages m_mainMessage;
154 AsyncAccessControl::MainLockType m_lock;
157 AsyncAccessControl::DoneLockType m_lockDone;
160 bool m_calledRequest;
168 volatile bool &m_sharedRts;
169 volatile bool &m_sharedDone;
170 volatile AsyncAccessControl::MainThreadMessages &m_mainMessage;
172 boost::condition_variable &m_condMainThread;
173 boost::condition_variable_any &m_condAsyncThread;
179 #endif // INCLUDED_AsyncAccessControl_h_GUID_4255BCEE_826C_4DB4_9368_9457ADBF9456 RAII object for use by an async thread to manage a request to send.
Definition: AsyncAccessControl.h:129
bool mainThreadDenyPermanently()
Permanently deny present and future requests.
Definition: AsyncAccessControl.cpp:122
The main namespace for all C++ elements of the framework, internal and external.
Definition: namespace_osvr.dox:3
bool mainThreadDeny()
Check for waiting async thread, and deny it permission to send if found.
Definition: AsyncAccessControl.cpp:117
Internal class handling the synchronization of an asynchronous thread wishing to communicate that has...
Definition: AsyncAccessControl.h:45
bool isNested() const
Method to find out if this is a nested RTS - primarily for testing.
Definition: AsyncAccessControl.h:150
AsyncAccessControl()
Constructor.
Definition: AsyncAccessControl.cpp:109