----------------------------------------------------------------------------- Add a watcher to the list -----------------------------------------------------------------------------
| 3929 | // Add a watcher to the list |
| 3930 | //----------------------------------------------------------------------------- |
| 3931 | bool Manager::AddWatcher |
| 3932 | ( |
| 3933 | pfnOnNotification_t _watcher, |
| 3934 | void* _context |
| 3935 | ) |
| 3936 | { |
| 3937 | // Ensure this watcher is not already on the list |
| 3938 | m_notificationMutex->Lock(); |
| 3939 | for( list<Watcher*>::iterator it = m_watchers.begin(); it != m_watchers.end(); ++it ) |
| 3940 | { |
| 3941 | if( ((*it)->m_callback == _watcher ) && ( (*it)->m_context == _context ) ) |
| 3942 | { |
| 3943 | // Already in the list |
| 3944 | m_notificationMutex->Unlock(); |
| 3945 | return false; |
| 3946 | } |
| 3947 | } |
| 3948 | |
| 3949 | m_watchers.push_back( new Watcher( _watcher, _context ) ); |
| 3950 | m_notificationMutex->Unlock(); |
| 3951 | return true; |
| 3952 | } |
| 3953 | |
| 3954 | //----------------------------------------------------------------------------- |
| 3955 | // <Manager::RemoveWatcher> |