I have written a small class for synchronizing threads of both Linux (actually Android) and Windows.
Here is the Win32 implementation of my interface :
Check also eventfd
. It seems to be almost equivalent of CreateEvent
if you need just one consumer and one producer.
CreateEvent
--> eventfd
CloseHandle
--> close
SetEvent
--> write
WaitForSingleObject
--> read
WaitForMultipleObjects
--> select
and read
corresponding fd
Some more reading http://www.sourcexr.com/articles/2013/10/26/lightweight-inter-process-signaling-with-eventfd