I'm trying to write a piece of C code that has two threads: The first
thread waits for a socket connection. The second thread is in a
continues cycle waiting for an period of time (lets say 500 ms) or an
incomming socket connection (received from the first thread). At this
moment I've created two threads were the first one is already waiting
for an incomming socket connection. I've also created a timer with
timer_create. My problem is that the second thread has to wait until
one of the events it is waiting for occurs. For completeness the
events are : an timer event or a message from the first thread that it
got an incomming socket connection.
Do I have to use a Semaphore here ... or do I have to use signals ...
or how do I solve this ???
help ;)