diff --git a/include/condy/detail/utils.hpp b/include/condy/detail/utils.hpp index 3102ef2d..7950e343 100644 --- a/include/condy/detail/utils.hpp +++ b/include/condy/detail/utils.hpp @@ -89,12 +89,6 @@ template class [[nodiscard]] Defer { bool active_ = true; }; -/** - * @brief Defer the execution of a function until the current scope ends. - * @param func The function to be executed upon scope exit. - * @return Defer object that will execute the function when it goes out of - * scope. - */ template auto defer(Func &&func) { return Defer>(std::forward(func)); } diff --git a/include/condy/runtime.hpp b/include/condy/runtime.hpp index 97b27835..db9bc144 100644 --- a/include/condy/runtime.hpp +++ b/include/condy/runtime.hpp @@ -48,18 +48,6 @@ class Runtime { CONDY_DELETE_COPY_MOVE(Runtime); public: - /** - * @brief Allow the runtime to exit when there are no pending works. - * @details By default, the runtime will keep running even if there are no - * pending works. Calling this function will allow the runtime to exit - * once all pending works are completed. - * @note This function is thread-safe and can be called from any thread. - */ - void allow_exit() noexcept { - exit_allowed_.store(true, std::memory_order_release); - wakeup_(); - } - void schedule(detail::WorkInvoker *work) noexcept { auto *curr_runtime = detail::Context::current().runtime(); if (curr_runtime == this) { @@ -131,6 +119,23 @@ class Runtime { pending_works_--; } + auto &bgid_pool() noexcept { return bgid_pool_; } + + auto &ring() noexcept { return ring_; } + +public: + /** + * @brief Allow the runtime to exit when there are no pending works. + * @details By default, the runtime will keep running even if there are no + * pending works. Calling this function will allow the runtime to exit + * once all pending works are completed. + * @note This function is thread-safe and can be called from any thread. + */ + void allow_exit() noexcept { + exit_allowed_.store(true, std::memory_order_release); + wakeup_(); + } + /** * @brief Run the runtime event loop in the current thread. * @details This function starts the event loop of the runtime in the @@ -190,8 +195,6 @@ class Runtime { } } - auto &ring() noexcept { return ring_; } - /** * @brief Get the file descriptor table of the runtime. * @return FdTable& Reference to the fd table of the runtime. @@ -210,12 +213,6 @@ class Runtime { */ auto &settings() noexcept { return settings_; } - /** - * @brief Get the buffer group ID pool. - * @return IdPool& Reference to the buffer group ID pool. - */ - auto &bgid_pool() noexcept { return bgid_pool_; } - private: static detail::Ring create_ring_(const RuntimeOptions &options) { io_uring_params params;