Equivalence of WaitForSingleObject() & ResetEvent(

2019-09-02 15:04发布

I'm trying to translate some code written using windows functions for a Linux environment and I couldn't figure out what the equivalence of these are in Linux. My understanding of WaitForSingleObject is that it waits for a flag and at the end of the function, ResetEvent resets that flag.

The piece of code I'm working with is written as follows:

HANDLE someEvent;
WaitForSingleObject(someEvent, INFINITE);
{ some code }
ResetEvent(someEvent);

1条回答
可以哭但决不认输i
2楼-- · 2019-09-02 15:53

You are looking for pthread_cond_wait

Here's a link to a simple usage. You will see how both sides of the communication work.

Andres

查看更多
登录 后发表回答