diff options
Diffstat (limited to 'Swiften/Network/BoostTimer.cpp')
m--------- | Swiften | 0 | ||||
-rw-r--r-- | Swiften/Network/BoostTimer.cpp | 34 |
2 files changed, 0 insertions, 34 deletions
diff --git a/Swiften b/Swiften new file mode 160000 +Subproject 8213ba16d0043d2461f4b031c881d61dda5a38c diff --git a/Swiften/Network/BoostTimer.cpp b/Swiften/Network/BoostTimer.cpp deleted file mode 100644 index fdbd45d..0000000 --- a/Swiften/Network/BoostTimer.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include "Swiften/Network/BoostTimer.h" - -#include <boost/date_time/posix_time/posix_time.hpp> -#include <boost/asio.hpp> - -#include "Swiften/EventLoop/MainEventLoop.h" - -namespace Swift { - -BoostTimer::BoostTimer(int milliseconds, boost::asio::io_service* service) : - timeout(milliseconds), timer(*service) { -} - -void BoostTimer::start() { - timer.expires_from_now(boost::posix_time::milliseconds(timeout)); - timer.async_wait(boost::bind(&BoostTimer::handleTimerTick, shared_from_this(), boost::asio::placeholders::error)); -} - -void BoostTimer::stop() { - timer.cancel(); -} - -void BoostTimer::handleTimerTick(const boost::system::error_code& error) { - if (error) { - assert(error == boost::asio::error::operation_aborted); - } - else { - MainEventLoop::postEvent(boost::bind(boost::ref(onTick)), shared_from_this()); - timer.expires_from_now(boost::posix_time::milliseconds(timeout)); - timer.async_wait(boost::bind(&BoostTimer::handleTimerTick, shared_from_this(), boost::asio::placeholders::error)); - } -} - -} |