summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '3rdParty/Boost/src/boost/asio/detail/deadline_timer_service.hpp')
-rw-r--r--3rdParty/Boost/src/boost/asio/detail/deadline_timer_service.hpp30
1 files changed, 27 insertions, 3 deletions
diff --git a/3rdParty/Boost/src/boost/asio/detail/deadline_timer_service.hpp b/3rdParty/Boost/src/boost/asio/detail/deadline_timer_service.hpp
index 82e0d43..839a98e 100644
--- a/3rdParty/Boost/src/boost/asio/detail/deadline_timer_service.hpp
+++ b/3rdParty/Boost/src/boost/asio/detail/deadline_timer_service.hpp
@@ -100,12 +100,35 @@ public:
ec = boost::system::error_code();
return 0;
}
+
+ BOOST_ASIO_HANDLER_OPERATION(("deadline_timer", &impl, "cancel"));
+
std::size_t count = scheduler_.cancel_timer(timer_queue_, impl.timer_data);
impl.might_have_pending_waits = false;
ec = boost::system::error_code();
return count;
}
+ // Cancels one asynchronous wait operation associated with the timer.
+ std::size_t cancel_one(implementation_type& impl,
+ boost::system::error_code& ec)
+ {
+ if (!impl.might_have_pending_waits)
+ {
+ ec = boost::system::error_code();
+ return 0;
+ }
+
+ BOOST_ASIO_HANDLER_OPERATION(("deadline_timer", &impl, "cancel_one"));
+
+ std::size_t count = scheduler_.cancel_timer(
+ timer_queue_, impl.timer_data, 1);
+ if (count == 0)
+ impl.might_have_pending_waits = false;
+ ec = boost::system::error_code();
+ return count;
+ }
+
// Get the expiry time for the timer as an absolute time.
time_type expires_at(const implementation_type& impl) const
{
@@ -140,18 +163,17 @@ public:
void wait(implementation_type& impl, boost::system::error_code& ec)
{
time_type now = Time_Traits::now();
- while (Time_Traits::less_than(now, impl.expiry))
+ ec = boost::system::error_code();
+ while (Time_Traits::less_than(now, impl.expiry) && !ec)
{
boost::posix_time::time_duration timeout =
Time_Traits::to_posix_duration(Time_Traits::subtract(impl.expiry, now));
::timeval tv;
tv.tv_sec = timeout.total_seconds();
tv.tv_usec = timeout.total_microseconds() % 1000000;
- boost::system::error_code ec;
socket_ops::select(0, 0, 0, 0, &tv, ec);
now = Time_Traits::now();
}
- ec = boost::system::error_code();
}
// Start an asynchronous wait on the timer.
@@ -167,6 +189,8 @@ public:
impl.might_have_pending_waits = true;
+ BOOST_ASIO_HANDLER_CREATION((p.p, "deadline_timer", &impl, "async_wait"));
+
scheduler_.schedule_timer(timer_queue_, impl.expiry, impl.timer_data, p.p);
p.v = p.p = 0;
}