Boost logo

Boost Users :

From: TD (thedsadude_at_[hidden])
Date: 2008-05-11 06:43:32


  Hello,

  I encounter many scenarios where a thread needs to sleep on both an IO event
and a logical event. Here's a common case. Thread A is an IO thread. It gets
data from a socket, puts it in a buffer pool, and notifies thread B. Thread B is
a worker thread. It calculates stuff, then returns buffers to the pool. It
follows then that thread A sometimes sleeps on IO (when waiting for socket
data), and sometimes sleeps waiting for the pool to become non-empty.
  It would be nice if there were a uniform way for the thread to sleep on stuff.
For example, using Windows API, a completion port can be used to sleep on both a
socket and an event object. In UNIX, thread A could select both a socket (for
data) and a pipe. I don't, however, understand how to do so cleanly using asio.
Anything that I can think up doubles up the size/complexity of the code, and
seems to use more system calls. I'd appreciate any suggestions.
  
  Thanks,

  TD


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net