| 135 | } |
| 136 | |
| 137 | bool |
| 138 | AsyncAccessControl::m_handleRTS(MainLockType &lock, |
| 139 | MainThreadMessages response, |
| 140 | MainThreadMessages postCompletionState) { |
| 141 | if (!lock.owns_lock() || (lock.mutex() != &m_mut)) { |
| 142 | throw std::logic_error( |
| 143 | "m_handleRTS requires its caller to pass a lock " |
| 144 | "owning the main mutex!"); |
| 145 | } |
| 146 | if (!m_rts) { |
| 147 | return false; // No RTS to handle, so didn't handle a RTS |
| 148 | } |
| 149 | |
| 150 | // In here, then, there must be an RTS. |
| 151 | m_mainMessage = response; |
| 152 | lock.unlock(); // Unlock to let the requestor through. |
| 153 | m_condAsyncThread.notify_one(); |
| 154 | { |
| 155 | DoneLockType finishedLock(m_mutDone); |
| 156 | while (!m_done) { |
| 157 | // Wait for the request to complete. |
| 158 | m_condMainThread.wait(finishedLock); |
| 159 | } |
| 160 | // Restore wait message (or deny message if denying permanently.) |
| 161 | m_mainMessage = postCompletionState; |
| 162 | return true; // handled an RTS, passed-in lock now unlocked. |
| 163 | } |
| 164 | } |
| 165 | |
| 166 | } // namespace connection |
| 167 | } // namespace osvr |
nothing calls this directly
no outgoing calls
no test coverage detected