Skip to content

Commit b0a7a01

Browse files
committed
fix: function inlining.
1 parent e50c28f commit b0a7a01

File tree

4 files changed

+9
-37
lines changed

4 files changed

+9
-37
lines changed

include/segment/service/async_service.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ struct async_context : detail::immovable {
5151
class interrupt_type {
5252
public:
5353
/** @brief Calls the underlying interrupt. */
54-
auto operator()() const -> void;
54+
inline auto operator()() const -> void;
5555
/** @brief Assigns a function to the underlying interrupt. */
56-
auto operator=(std::function<void()> func) noexcept -> interrupt_type &;
56+
inline auto operator=(std::function<void()> func) noexcept -> interrupt_type &;
5757
/** @brief Tests to see if the interrupt has been assigned to. */
58-
explicit operator bool() const noexcept;
58+
inline explicit operator bool() const noexcept;
5959

6060
private:
6161
/** @brief The underlying interrupt function. */
@@ -157,6 +157,7 @@ template <ServiceLike Service> class async_service : public async_context {
157157

158158
} // namespace cloudbus::service
159159

160+
#include "impl/async_context_impl.hpp" // IWYU pragma: export
160161
#include "impl/async_service_impl.hpp" // IWYU pragma: export
161162

162163
#endif // CLOUDBUS_ASYNC_SERVICE_HPP

include/segment/service/impl/async_context_impl.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
* @brief This file defines the asynchronous service.
2020
*/
2121
#pragma once
22-
#ifndef CLOUDBUS_ASYNC_SERVICE_IMPL_HPP
23-
#define CLOUDBUS_ASYNC_SERVICE_IMPL_HPP
22+
#ifndef CLOUDBUS_ASYNC_CONTEXT_IMPL_HPP
23+
#define CLOUDBUS_ASYNC_CONTEXT_IMPL_HPP
2424
#include "segment/detail/with_lock.hpp"
2525
#include "segment/service/async_service.hpp"
2626

@@ -56,4 +56,4 @@ inline async_context::interrupt_type::operator bool() const noexcept
5656
return static_cast<bool>(fn_);
5757
}
5858
} // namespace cloudbus::service
59-
#endif // CLOUDBUS_ASYNC_SERVICE_IMPL_HPP
59+
#endif // CLOUDBUS_ASYNC_CONTEXT_IMPL_HPP

include/segment/service/impl/async_service_impl.hpp

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -26,36 +26,6 @@
2626

2727
#include <stdexec/execution.hpp>
2828
namespace cloudbus::service {
29-
30-
auto async_context::signal(int signum) -> void
31-
{
32-
assert(signum >= 0 && signum < END && "signum must be a valid signal.");
33-
sigmask.fetch_or(1 << signum);
34-
if (interrupt)
35-
interrupt();
36-
}
37-
38-
auto async_context::interrupt_type::operator()() const -> void
39-
{
40-
using namespace detail;
41-
auto func = with_lock(std::unique_lock{mtx_}, [&] { return fn_; });
42-
func();
43-
}
44-
45-
auto async_context::interrupt_type::operator=(
46-
std::function<void()> func) noexcept -> interrupt_type &
47-
{
48-
std::lock_guard lock{mtx_};
49-
fn_ = std::move(func);
50-
return *this;
51-
}
52-
53-
async_context::interrupt_type::operator bool() const noexcept
54-
{
55-
std::lock_guard lock{mtx_};
56-
return static_cast<bool>(fn_);
57-
}
58-
5929
template <ServiceLike Service>
6030
template <typename Fn>
6131
requires std::is_invocable_r_v<bool, Fn>

include/segment/service/impl/async_tcp_service_impl.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@
1818
* @brief This file defines an asynchronous tcp service.
1919
*/
2020
#pragma once
21-
#include <system_error>
2221
#ifndef CLOUDBUS_ASYNC_TCP_SERVICE_IMPL_HPP
2322
#define CLOUDBUS_ASYNC_TCP_SERVICE_IMPL_HPP
2423
#include "segment/service/async_tcp_service.hpp"
24+
25+
#include <system_error>
2526
namespace cloudbus::service {
2627
template <typename TCPStreamHandler>
2728
template <typename T>

0 commit comments

Comments
 (0)