Skip to content

Commit

Permalink
Merge pull request #38 from bherw/bherw/fix-close-race
Browse files Browse the repository at this point in the history
fix: race condition in close #37
  • Loading branch information
andreiavrammsd committed Jan 25, 2024
2 parents 2cfe2c2 + 1dab254 commit 51c39d5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion include/msd/channel.inl
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ constexpr bool channel<T>::empty() const noexcept
template <typename T>
void channel<T>::close() noexcept
{
is_closed_.store(true);
{
std::unique_lock<std::mutex> lock{mtx_};
is_closed_.store(true);
}
cnd_.notify_all();
}

Expand Down

0 comments on commit 51c39d5

Please sign in to comment.