Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

Commit

Permalink
Fix async_utils
Browse files Browse the repository at this point in the history
  • Loading branch information
MBkkt committed Nov 24, 2023
1 parent 0a8d717 commit acdbdcb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/utils/async_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ ThreadPool<UseDelay>::ThreadPool(size_t threads, basic_string_view<Char> name) {

template<bool UseDelay>
void ThreadPool<UseDelay>::start(size_t threads, basic_string_view<Char> name) {
std::lock_guard lock{m_};
IRS_ASSERT(threads_.empty());
threads_.reserve(threads);
for (size_t i = 0; i != threads; ++i) {
Expand Down Expand Up @@ -123,7 +124,8 @@ void ThreadPool<UseDelay>::Work() {
if constexpr (UseDelay) {
auto& top = tasks_.top();
if (top.at > Clock::now()) {
cv_.wait_until(lock, top.at);
auto const at = top.at;
cv_.wait_until(lock, at);
continue;
}
fn = std::move(const_cast<Func&>(top.fn));
Expand Down

0 comments on commit acdbdcb

Please sign in to comment.