当前位置: 首页>>代码示例>>C++>>正文


C++ unique_lock::unlock方法代码示例

本文整理汇总了C++中boost::unique_lock::unlock方法的典型用法代码示例。如果您正苦于以下问题:C++ unique_lock::unlock方法的具体用法?C++ unique_lock::unlock怎么用?C++ unique_lock::unlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在boost::unique_lock的用法示例。


在下文中一共展示了unique_lock::unlock方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: flush

    bool coalescing_message_handler::flush(
        boost::unique_lock<mutex_type>& l,
        bool stop_buffering)
    {
        HPX_ASSERT(l.owns_lock());

        if (!stopped_ && stop_buffering) {
            stopped_ = true;

            util::unlock_guard<boost::unique_lock<mutex_type> > ul(l);
            timer_.stop();              // interrupt timer
        }

        if (buffer_.empty())
            return false;

        detail::message_buffer buff (buffer_.capacity());
        std::swap(buff, buffer_);

        l.unlock();

        HPX_ASSERT(NULL != pp_);
        buff(pp_);                   // 'invoke' the buffer

        return true;
    }
开发者ID:parsa,项目名称:hpx,代码行数:26,代码来源:coalescing_message_handler.cpp

示例2: wait_until

future_status result::wait_until(time_point const& wait_timeout_time,
						boost::unique_lock<boost::mutex>& lock) const
{
	if(ready(lock))
		return future_status::ready;

	while(!expired() && !(clock_type::now() > wait_timeout_time))
	{
		// note: don't set to wait for 0 ms, it might not timeout
		if(m_condition.wait_for(lock, boost::chrono::milliseconds(1),
			boost::bind(&result::ready, this, boost::ref(lock))))
		{
			return future_status::ready;
		}

		if(expired() || (clock_type::now() > wait_timeout_time))
			break;

		lock.unlock();
		io_runner::poll_one(*m_io_service);
		lock.lock();
	}

	if(clock_type::now() > wait_timeout_time)
		return future_status::timeout;

	BOOST_ASSERT(expired());

	m_exception = boost::make_shared<remote_error>
		(remote_error::timeout, "remote call timeout");

	m_ready = true;
	return future_status::ready;
}
开发者ID:beimprovised,项目名称:CppRemote,代码行数:34,代码来源:result.cpp

示例3: accept_locked

        connection_ptr accept_locked(boost::unique_lock<mutex_type> & header_lock)
        {
            connection_ptr res;
            util::mpi_environment::scoped_try_lock l;

            if(l.locked)
            {
                MPI_Status status;
                if(request_done_locked(hdr_request_, &status))
                {
                    header h = new_header();
                    l.unlock();
                    header_lock.unlock();
                    res.reset(
                        new connection_type(
                            status.MPI_SOURCE
                          , h
                          , pp_
                        )
                    );
                    return res;
                }
            }
            return res;
        }
开发者ID:devangb,项目名称:hpx,代码行数:25,代码来源:receiver.hpp

示例4: setPlanet

void Bank::setPlanet(boost::unique_lock<boost::mutex>& lock, int8_t planet) {
    planet_ = planet;
	
	auto dispatcher = GetEventDispatcher();

	lock.unlock();
	
	dispatcher->DispatchMainThread(std::make_shared<CreatureObjectEvent>("CreatureObject::PersistHomeBank", owner_->GetCreature()));
}
开发者ID:ELMERzark,项目名称:mmoserver,代码行数:9,代码来源:Bank.cpp

示例5: setCredits

void Bank::setCredits(boost::unique_lock<boost::mutex>& lock, uint32 credits) {
	credits_ = credits;
	auto dispatcher = GetEventDispatcher();

	lock.unlock();
	
	dispatcher->Dispatch(std::make_shared<CreatureObjectEvent>("CreatureObject::BankCredits", owner_->GetCreature()));
	dispatcher->DispatchMainThread(std::make_shared<CreatureObjectEvent>("CreatureObject::PersistBankCredits", owner_->GetCreature()));
	
}
开发者ID:ELMERzark,项目名称:mmoserver,代码行数:10,代码来源:Bank.cpp

示例6: change_received

bool StatelessReader::change_received(CacheChange_t* change, boost::unique_lock<boost::recursive_mutex> &lock)
{
    // Only make visible the change if there is not other with bigger sequence number.
    // TODO Revisar si no hay que incluirlo.
    if(!mp_history->thereIsUpperRecordOf(change->writerGUID, change->sequenceNumber))
    {
        if(mp_history->received_change(change, 0))
        {
            if(getListener() != nullptr)
            {
                lock.unlock();
                getListener()->onNewCacheChangeAdded((RTPSReader*)this,change);
                lock.lock();
            }

            mp_history->postSemaphore();
            return true;
        }
    }

	return false;
}
开发者ID:dhood,项目名称:Fast-RTPS,代码行数:22,代码来源:StatelessReader.cpp


注:本文中的boost::unique_lock::unlock方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。