Linux/POSIX equivalent for Win32's CreateEvent, SetEvent, WaitForSingleObject

后端 未结 4 2065
感情败类
感情败类 2020-12-03 20:09

I have written a small class for synchronizing threads of both Linux (actually Android) and Windows.

Here is the Win32 implementation of my interface :



        
4条回答
  •  醉梦人生
    2020-12-03 20:41

    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

提交回复
热议问题