Skip to content

rts/win32: Ensure reliability of IO manager shutdown

Ben Gamari requested to merge wip/T23691 into master

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 (closed).

Merge request reports