Skip to content
Snippets Groups Projects
Commit 316bf82a authored by Ben Gamari's avatar Ben Gamari Committed by Marge Bot
Browse files

rts/win32: Ensure reliability of IO manager shutdown

When the Win32 threaded IO manager shuts down, `ioManagerDie` sends an
`IO_MANAGER_DIE` event to the IO manager thread using the
`io_manager_event` event object. Finally, it will closes the event object,
and invalidate `io_manager_event`.

Previously, `readIOManagerEvent` would see that `io_manager_event` is
invalid and return `0`, suggesting that everything is right with the
world. This meant that if `ioManagerDie` invalidated the handle before
the event manager was blocked on the event we would end up in a
situation where the event manager would never realize it was asked to
shut down.

Fix this by ensuring that `readIOManagerEvent` instead returns
`IO_MANAGER_DIE` when we detect that the event object has been
invalidated by `ioManagerDie`.

Fixes #23691.
parent c196e320
No related branches found
No related tags found
1 merge request!11031Marge Bot Batch MR - DO NOT TOUCH
......@@ -79,7 +79,9 @@ readIOManagerEvent (void)
}
}
} else {
res = 0;
// Making it here after getIOManagerEvent has been called means that we
// have hit ioManagerDie, which closed our event object.
res = IO_MANAGER_DIE;
}
OS_RELEASE_LOCK(&event_buf_mutex);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment