Skip to content

Commit

Permalink
Comment await_stop().
Browse files Browse the repository at this point in the history
  • Loading branch information
aliddell committed Nov 20, 2023
1 parent 47a22b7 commit 38f42f5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/common.hh
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ struct ThreadPool final
~ThreadPool() noexcept;

void push_to_job_queue(JobT&& job);

/**
* @brief Block until all jobs on the queue have processed, then spin down
* the threads.
* @note After calling this function, the job queue no longer accepts jobs.
*/
void await_stop() noexcept;

private:
Expand All @@ -73,7 +79,6 @@ struct ThreadPool final

std::atomic<bool> is_accepting_jobs_;

/// Multithreading
std::optional<common::ThreadPool::JobT> pop_from_job_queue_() noexcept;
[[nodiscard]] bool should_stop_() const noexcept;
void thread_worker_();
Expand Down

0 comments on commit 38f42f5

Please sign in to comment.