R
Richard Cranium
Hello,
I have an interesting problem:
I've got one thread in my program meant to maintain a timing subsystem
and to do network I/O. It uses the select() system call to either wait
for I/O or "time out" and "handle" some arbitrary "event".
The timeout value for select() is calculated off of a list of "active
timers" which contains all the necessary information to correctly guess
when select() needs to wake up again if no network I/O occurs.
The problem is, though, that my application is multi-threaded and
there are times where other threads create and destroy timers. When
this happens I need to break out of my select() in the I/O & timer
thread, recalulate the timeout value and then go back to sleep.
Is there a way I can cause a thread to wake up, or does anyone have a
suggestion as how to work around this?
Thanks.
-Richard
I have an interesting problem:
I've got one thread in my program meant to maintain a timing subsystem
and to do network I/O. It uses the select() system call to either wait
for I/O or "time out" and "handle" some arbitrary "event".
The timeout value for select() is calculated off of a list of "active
timers" which contains all the necessary information to correctly guess
when select() needs to wake up again if no network I/O occurs.
The problem is, though, that my application is multi-threaded and
there are times where other threads create and destroy timers. When
this happens I need to break out of my select() in the I/O & timer
thread, recalulate the timeout value and then go back to sleep.
Is there a way I can cause a thread to wake up, or does anyone have a
suggestion as how to work around this?
Thanks.
-Richard