I have a thread whose job is to send messages to UDP peers. the threads sends the messages iff one of the following apply:
1) a certain time has passed since the last time it sent a message (like a timeout).
2) an update boolean flag in a shared struct has been raised by other thread.
i want to be able to wait for these conditions to happen so i would know when to send the message.
the simplest way i can do it is by making a loop that repeats until one of the conditions satisfy. i'm afraid it is busy waiting and will consume a lot of CPU time for nothing. I don;t want to use sleep() either.
i don't mind for a C++ solution as long as it's easy to understand and implement since i'm not very familiar with C++.
Thanks !