timer.hpp
// ---------------------------------------------------------------------
// pion: a Boost C++ framework for building lightweight HTTP interfaces
// ---------------------------------------------------------------------
// Copyright (C) 2007-2014 Splunk Inc. (https://github.com/splunk/pion)
//
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
//
#ifndef __PION_TCP_TIMER_HEADER__
#define __PION_TCP_TIMER_HEADER__
#include <boost/asio.hpp>
#include <boost/bind.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <boost/thread/mutex.hpp>
#include <pion/config.hpp>
#include <pion/tcp/connection.hpp>
namespace pion { // begin namespace pion
namespace tcp { // begin namespace tcp
class PION_API timer
: public boost::enable_shared_from_this<timer>
{
public:
timer(const tcp::connection_ptr& conn_ptr);
void start(const boost::uint32_t seconds);
void cancel(void);
private:
void timer_callback(const boost::system::error_code& ec);
tcp::connection_ptr m_conn_ptr;
boost::asio::deadline_timer m_timer;
boost::mutex m_mutex;
bool m_timer_active;
bool m_was_cancelled;
};
typedef boost::shared_ptr<timer> timer_ptr;
} // end namespace tcp
} // end namespace pion
#endif
pion::tcp::timer
Definition: timer.hpp:29
pion
Definition: admin_rights.hpp:19