本文整理汇总了C++中boost::shared_mutex::unlock_shared方法的典型用法代码示例。如果您正苦于以下问题:C++ shared_mutex::unlock_shared方法的具体用法?C++ shared_mutex::unlock_shared怎么用?C++ shared_mutex::unlock_shared使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boost::shared_mutex
的用法示例。
在下文中一共展示了shared_mutex::unlock_shared方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: trackGetNext
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;
}
}
}
示例2: Finished
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;
}
示例3: newDataAvailable
void StatisticsMultiplexerSync::newDataAvailable() throw() {
listenersLock.lock_shared();
for( size_t i = listeners.size(); i--; ) {
ListenerData& cur = listeners[i];
cur.listener->newDataAvailable();
}
listenersLock.unlock_shared();
}
示例4: notifyAvailableStatisticsChange
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();
}
示例5: release_shared
void release_shared ()
{
try
{
_m.unlock_shared() ;
}
catch(...)
{
SDB_ASSERT ( FALSE, "SLatch release shared failed" ) ;
}
}
示例6: thread3_func_workaround
void thread3_func_workaround()
{
while (true)
{
if (mutex.timed_lock_shared(boost::posix_time::milliseconds(200)))
{
std::cout << "Shared lock acquired" << std::endl
<< "Test successful" << std::endl;
mutex.unlock_shared();
break;
}
boost::this_thread::sleep(boost::posix_time::milliseconds(100));
}
}