src/corosio/src/timer.cpp
100.0% Lines (18/18)
100.0% Functions (8/8)
src/corosio/src/timer.cpp
| Line | Hits | Source Code |
|---|---|---|
| 1 | // | |
| 2 | // Copyright (c) 2025 Vinnie Falco (vinnie.falco@gmail.com) | |
| 3 | // Copyright (c) 2026 Steve Gerbino | |
| 4 | // | |
| 5 | // Distributed under the Boost Software License, Version 1.0. (See accompanying | |
| 6 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
| 7 | // | |
| 8 | // Official repository: https://github.com/cppalliance/corosio | |
| 9 | // | |
| 10 | ||
| 11 | #include <boost/corosio/timer.hpp> | |
| 12 | #include <boost/corosio/detail/timer_service.hpp> | |
| 13 | ||
| 14 | namespace boost::corosio { | |
| 15 | ||
| 16 | 8649 | timer::~timer() = default; |
| 17 | ||
| 18 | 8645 | timer::timer(capy::execution_context& ctx) |
| 19 | 8645 | : io_timer(handle(ctx, detail::timer_service_direct(ctx))) |
| 20 | { | |
| 21 | 8645 | } |
| 22 | ||
| 23 | 2 | timer::timer(capy::execution_context& ctx, time_point t) : timer(ctx) |
| 24 | { | |
| 25 | 2 | expires_at(t); |
| 26 | 2 | } |
| 27 | ||
| 28 | 2 | timer::timer(timer&& other) noexcept : io_timer(std::move(other)) {} |
| 29 | ||
| 30 | timer& | |
| 31 | 4 | timer::operator=(timer&& other) noexcept |
| 32 | { | |
| 33 | 4 | if (this != &other) |
| 34 | 4 | h_ = std::move(other.h_); |
| 35 | 4 | return *this; |
| 36 | } | |
| 37 | ||
| 38 | std::size_t | |
| 39 | 8 | timer::do_cancel() |
| 40 | { | |
| 41 | 8 | return detail::timer_service_cancel(get()); |
| 42 | } | |
| 43 | ||
| 44 | std::size_t | |
| 45 | 2 | timer::do_cancel_one() |
| 46 | { | |
| 47 | 2 | return detail::timer_service_cancel_one(get()); |
| 48 | } | |
| 49 | ||
| 50 | std::size_t | |
| 51 | 6 | timer::do_update_expiry() |
| 52 | { | |
| 53 | 6 | return detail::timer_service_update_expiry(get()); |
| 54 | } | |
| 55 | ||
| 56 | } // namespace boost::corosio | |
| 57 |