safeprint& operator<<(const std::string& msg) { cout_lock.lock_shared(); std::cout << msg; cout_lock.unlock(); //std::cout << "public safe" << std::endl; return *this; }
void StatisticsMultiplexerSync::newDataAvailable() throw() { listenersLock.lock_shared(); for( size_t i = listeners.size(); i--; ) { ListenerData& cur = listeners[i]; cur.listener->newDataAvailable(); } listenersLock.unlock_shared(); }
void StatisticsMultiplexerSync::notifyAvailableStatisticsChange( const std::vector<std::shared_ptr<Statistic> > & statistics, bool addedStatistics, bool removedStatistics ) throw() { listenersLock.lock_shared(); for( size_t i = listeners.size(); i--; ) { ListenerData& cur = listeners[i]; cur.listener->notifyAvailableStatisticsChange( statistics, addedStatistics, removedStatistics ); } lastStatistics = & statistics; listenersLock.unlock_shared(); }
bool TrackManager::trackGetNext( TSearchID pID, CTrackInfo & pNextTrack) { MP3Data * t_Data = NULL; mySharedMutex.lock_shared(); if(pID == ALL_TRACKS_SEARCH_ID) // Get whole track list { t_Data = myController->getTrackList()->getNext(); if(t_Data != NULL) // returns current iterator-item { pNextTrack.mAlbum = t_Data->getAlbum(); pNextTrack.mInterpret = t_Data->getArtist(); pNextTrack.mTitle = t_Data->getTitle(); pNextTrack.mIndex = t_Data->getId(); mySharedMutex.unlock_shared(); return true; // successfully retrieved item } else // current iterator-item is NULL { mySharedMutex.unlock_shared(); return false; } } else // get node list for the search-ID { NodeList * t_searchResult = searchResultList[pID]; if(t_searchResult) { t_Data = t_searchResult->getNext(); if(t_Data != NULL) { pNextTrack.mAlbum = t_Data->getAlbum(); pNextTrack.mInterpret = t_Data->getArtist(); pNextTrack.mTitle = t_Data->getTitle(); pNextTrack.mIndex = t_Data->getId(); mySharedMutex.unlock_shared(); return true; } else { mySharedMutex.unlock_shared(); return false; } } else { mySharedMutex.unlock_shared(); return false; } } }
void get_shared () { try { _m.lock_shared () ; } catch(...) { SDB_ASSERT ( FALSE, "SLatch get shared failed" ) ; } }
bool TransferInfo::Finished() { checkbook_mutex_.lock_shared(); bool finished = true; for (int i = 0; i < checkbook_->slice_size(); ++i) { VLOG(4) << i << " checkbook slice: " << checkbook_->slice(i).finished(); if (!checkbook_->slice(i).finished()) { finished = false; VLOG(1) << "slice: " << i << " unfinished"; checkbook_mutex_.unlock_shared(); return false; } } checkbook_mutex_.unlock_shared(); return true; }
TopologyType RamTopology::registerType( const string& name ) throw() { TopologyType result; typesLock.lock_shared(); IGNORE_EXCEPTIONS( result = typesByName.at( name ); );
safeprint& operator<<(std::ostream& ) { cout_lock.lock_shared(); std::cout << "public safe" << std::endl; cout_lock.unlock(); return *this; }