本文整理汇总了C++中boost::asio::deadline_timer::cancel方法的典型用法代码示例。如果您正苦于以下问题:C++ deadline_timer::cancel方法的具体用法?C++ deadline_timer::cancel怎么用?C++ deadline_timer::cancel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boost::asio::deadline_timer
的用法示例。
在下文中一共展示了deadline_timer::cancel方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: HandleReceiveFrom
void Detection::HandleReceiveFrom(int packet_type, int tracker_index, boost::asio::deadline_timer& timer,
const boost::system::error_code& error, size_t bytes_recvd)
{
std::ofstream fout("text.txt", std::ofstream::ate|std::ofstream::app);
if (!error || error == boost::asio::error::message_size)
{
if (packet_type == 0) // bs
{
int tracker_count = data_[14] * 256 + data_[13];
fout << "向bs查询到" << tracker_count << "个tracker" << std::endl;
fout.close();
has_tracker_list = true;
timer.cancel();
}
else if (packet_type == 1) // tracker
{
int peer_count = data_[28] * 256 + data_[27];
//mu.lock();
std::string result = "";
result.append("向tracker(");
result.append(m_tracker_infos[tracker_index].ip);
result.append(":");
boost::uint16_t port = m_tracker_infos[tracker_index].port;
char tmp[10];
itoa(m_tracker_infos[tracker_index].port, tmp, 10);
result.append(tmp);
result.append( ")查询到");
itoa(peer_count, tmp, 10);
result.append(tmp);
result.append("个peer");
// result += "向tracker(" + m_tracker_infos[tracker_index].ip + ":" + m_tracker_infos[tracker_index].port
// + ")查询到" + peer_count + "个peer";
result_trackers.push_back(result);
// fout << "向tracker(" << m_tracker_infos[tracker_index].ip << ":" << m_tracker_infos[tracker_index].port
// << ")查询到" << peer_count << "个peer" << std::endl;
// fout.close();
// mu.unlock();
timer.cancel();
has_peer_list = true;
}
}
else if (error != boost::asio::error::operation_aborted)
{
if (packet_type == 0)
{
fout << error.message() << std::endl;
fout.close();
}
else if (packet_type == 1)
{
result_trackers.push_back(error.message());
}
}
}
开发者ID:huangyt,项目名称:MyProjects,代码行数:55,代码来源:Detection.cpp示例2: setTimeout
/// Set / reset the timeout timer
void setTimeout( unsigned timeout )
{
if ( timeout == 0 ) {
LOG_TRACE << "Timeout for connection to " << identifier() << " reset";
m_timer.cancel();
}
else {
m_timer.cancel();
m_timer.expires_from_now( boost::posix_time::seconds( timeout ));
m_timer.async_wait( m_strand.wrap( boost::bind( &ConnectionBase::handleTimeout,
this->shared_from_this(),
boost::asio::placeholders::error )));
LOG_TRACE << "Timeout for connection to " << identifier() << " set to " << timeout << "s";
}
}
开发者ID:Wolframe,项目名称:Wolframe,代码行数:16,代码来源:connectionBase.hpp示例3: event_handler
/// Receive an event from the underlying comms connection.
/// @param event the type of event.
/// @param weak_ptr a weak ponter to the underlying comms connection.
void event_handler(int event,
typename connection_type::weak_pointer weak_ptr)
{
// Use the raw pointer of the connection as the map key.
void* pointer(weak_ptr.lock().get());
if (!pointer)
return;
switch(event)
{
case via::comms::CONNECTED:
timer_.cancel();
rx_buffer_.clear();
rx_.clear();
if (connected_handler_)
connected_handler_();
break;
case via::comms::RECEIVED:
receive_handler();
break;
case via::comms::SENT:
if (message_sent_handler_)
message_sent_handler_();
break;
case via::comms::DISCONNECTED:
disconnected_handler();
break;
default:
break;
}
}
开发者ID:chtq,项目名称:via-httplib,代码行数:34,代码来源:http_client.hpp示例4: handle_send
void handle_send(const boost::system::error_code& ec, size_t size){
timer.cancel();
if(!ec) // ok
;
else if(ec == boost::asio::error::message_size) // mtu handle
;
}
开发者ID:socgerlia,项目名称:srpg,代码行数:7,代码来源:session.hpp示例5: read_callback
void read_callback(bool& dataAvailable, boost::asio::deadline_timer &timeout, const boost::system::error_code& error, std::size_t bytes_transferred) {
if (error || !bytes_transferred) {
dataAvailable = false;
return;
}
timeout.cancel();
dataAvailable = true;
printw("data is available");
}
开发者ID:myrtleTree33,项目名称:Z-Project,代码行数:9,代码来源:master.cpp示例6: stop
void stop(bool wait)
{
_timer.cancel();
if(_in_callback)
{
// If we're called re-entrantly, or a callback is in progress on another thread,
// abandon the timer and let it delete itself at the end of the callback
_orphan = true;
}
else
{
if (wait || !_repeat)
{
_completed.wait();
}
delete this;
}
}
开发者ID:Synenkyi,项目名称:emscripten-casablanca,代码行数:18,代码来源:pplxlinux.cpp示例7: updateProperty
void updateProperty(const Property::ConstPtr &theProperty)
{
ViewerApp::updateProperty(theProperty);
// one of our porperties was changed
if(theProperty == m_texturePath)
{
try
{
m_textures[0] = gl::createTextureFromFile(*m_texturePath);
if(m_textures[0])
{
// ->CL_INVALID_GL_OBJECT: internal format must be pow2 (RG, RGBA)
m_cl_image = cl::ImageGL(m_context, CL_MEM_READ_WRITE, GL_TEXTURE_2D, 0,
m_textures[0].getId());
}
}
catch(cl::Error &error){LOG_ERROR << error.what() << "(" << oclErrorString(error.err()) << ")";}
catch (FileNotFoundException &e){LOG_WARNING << e.what();}
}
else if(theProperty == m_videoPath)
{
}
else if(theProperty == m_num_particles)
{
scene().removeObject(m_mesh);
initParticles(*m_num_particles);
}
else if(theProperty == m_point_size)
{
m_pointMaterial->setPointSize(*m_point_size);
m_timer.cancel();
m_timer.expires_from_now(boost::posix_time::seconds(2.f));
m_timer.async_wait(boost::bind(&OpenCLTest::tick, this, _1));
}
else if(theProperty == m_point_color)
{
m_mesh->material()->setDiffuse(*m_point_color);
}
}
开发者ID:mojovski,项目名称:KinskiGL,代码行数:43,代码来源:main.cpp示例8:
inline wamp_dealer_invocation::~wamp_dealer_invocation()
{
m_timeout_timer.cancel();
}
开发者ID:VinnyOG,项目名称:bonefish,代码行数:4,代码来源:wamp_dealer_invocation.hpp示例9: cancel
void cancel() {
mMessageId = -1;
mTimer.cancel();
}
开发者ID:danx0r,项目名称:sirikata,代码行数:4,代码来源:SentMessage.cpp示例10: cancel
void SenderImpl::cancel()
{
m_timer.cancel();
}
开发者ID:catedrasaes-umu,项目名称:corbasim,代码行数:4,代码来源:Sender.cpp示例11: cancel
/// Stop executing random behaviors.
void cancel() {
timer_.cancel();
started_.clear();
}
开发者ID:jettan,项目名称:robotutor,代码行数:5,代码来源:pose_changer.cpp示例12: stop
void stop()
{
echo_timer_.cancel();
}
开发者ID:mpapierski,项目名称:simpledaemon,代码行数:4,代码来源:main.cpp本文标签属性:
示例:示例英语
代码:代码转换器
deadline_timer:deadline_timer
cancel:cancel什么意思