What is the equivalent linux API for WaitForMultipleObjects() and WSAEnumNetworkEvents()? Can we use pthread_cond_wait() for WaitForMultipleObjects?
For developers coming from a Windows background, we faced the same issue when porting some code from Win32 to pthreads and created an open source (MIT-licensed) library called pevents which implements WaitForMultipleObjects()
on Linux, with support for both auto and manual reset events. It should behave in the same way as WIN32 events on Windows do.
Well there is no straightforward API in Linux, that does the WaitForMultipleObjects()
equivalent.
WaitForSingleObject and WaitForMultipleObjects equivalent in Linux? contains answer to the first part and perhaps a better explanation too.
For WSAEnumNetworkEvents()
, in Linux, use poll()
or select()
based on your requirements. Another application libevent
might also be useful.
Reference:
poll(3)
man page
select(3)
man page
libevent
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With