Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions include/condy/detail/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,6 @@ template <typename Func> 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 <typename Func> auto defer(Func &&func) {
return Defer<std::decay_t<Func>>(std::forward<Func>(func));
}
Expand Down
37 changes: 17 additions & 20 deletions include/condy/runtime.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -210,12 +213,6 @@ class Runtime {
*/
auto &settings() noexcept { return settings_; }

/**
* @brief Get the buffer group ID pool.
* @return IdPool<uint16_t>& 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;
Expand Down
Loading