This is a link to an MCVE that demonstrates the deadlock
It contains five parts:
SharedEvent is an implementation of an AutoResetEvent that is stored in shared memory.
CreatedSharedEvent creates a named shared memory object in which a SharedEvent is allocated. It provides an accessor method that returns a reference to the SharedEvent.
OpenedSharedEvent opens a named shared memory object in which a SharedEvent has already been allocated. It also provides an accessor method that returns a reference to the SharedEvent.
A server console application that creates a SharedEvent using a CreatedShareEvent and sets the event every 2 seconds. It prints a message every time the event is set.
A console application that opens the shared event using an OpenedShareEvent and waits on the event in a loop. It prints a message every time the wait call returns.
To reproduce the problem:
Run the server. Observe the messages printed every 2 seconds.
Run the client. Observe the messages printed every 2 seconds.
Close the client. Observe that the server ceases to print messages. It is blocked in interprocess_condition::notify_one()