----------------------------------------------------------------------------- Add a watcher to our object. -----------------------------------------------------------------------------
| 62 | // Add a watcher to our object. |
| 63 | //----------------------------------------------------------------------------- |
| 64 | void WaitImpl::AddWatcher |
| 65 | ( |
| 66 | Wait::pfnWaitNotification_t _callback, |
| 67 | void* _context |
| 68 | ) |
| 69 | { |
| 70 | // Add the watcher to our list |
| 71 | Watcher watcher; |
| 72 | watcher.m_callback = _callback; |
| 73 | watcher.m_context = _context; |
| 74 | |
| 75 | EnterCriticalSection( &m_criticalSection ); |
| 76 | |
| 77 | m_watchers.push_back( watcher ); |
| 78 | |
| 79 | LeaveCriticalSection( &m_criticalSection ); |
| 80 | |
| 81 | // If the object is already in a signalled state, notify the watcher immediately |
| 82 | if( m_owner->IsSignalled() ) |
| 83 | { |
| 84 | _callback( _context ); |
| 85 | } |
| 86 | |
| 87 | } |
| 88 | |
| 89 | //----------------------------------------------------------------------------- |
| 90 | // <WaitImpl::RemoveWatcher> |
nothing calls this directly
no test coverage detected