0

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
    Have you tried to google? This one: https://stackoverflow.com/questions/33098419/linux-posix-equivalent-for-win32s-createevent-setevent-waitforsingleobject. Or that one: https://stackoverflow.com/questions/2719580/waitforsingleobject-and-waitformultipleobjects-equivalent-in-linux. And [others](https://www.google.ru/search?q=WaitForSingleObject+Linux+site:stackoverflow.com) – Tsyvarev Jun 09 '18 at 00:06
  • 3
    Possible duplicate of [WaitForSingleObject and WaitForMultipleObjects equivalent in Linux](https://stackoverflow.com/q/2719580/608639) and [Porting windows manual-reset event to Linux?](https://stackoverflow.com/q/178114/608639) – jww Jun 09 '18 at 01:46
  • @Tsyvarev yes obviously I would google before posting on here so someone like you wouldn't tell me to go google it... those answers were vague and didn't help that's why i asked again –  Jun 11 '18 at 15:28
  • But what is "vague" in [this answer](https://stackoverflow.com/a/33099359/3440745)? Or in some other ones? If you want some clarification, ask exactly what answer is unclear, and what exactly is unclear in it. – Tsyvarev Jun 11 '18 at 17:41

1 Answers1

0

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