Skip to content
Open
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
7 changes: 7 additions & 0 deletions asio/include/asio/detail/impl/win_iocp_io_context.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,13 @@ size_t win_iocp_io_context::do_one(DWORD msec,
{
for (;;)
{
// Check if the context has been stopped
if (::InterlockedExchangeAdd(&stopped_, 0) != 0)
{
ec = asio::error_code();
return 0;
}

// Try to acquire responsibility for dispatching timers and completed ops.
if (::InterlockedCompareExchange(&dispatch_required_, 0, 1) == 1)
{
Expand Down