From: Munagala Ramanath (amberarrow_at_[hidden])
Date: 2004-01-06 09:08:46
--- Roland <roland.schwarz_at_[hidden]> wrote:
> I found myself writing a controller for a machine, that has a bidirectional
> communication line via a serial (RS232) port. This controller however
> also had to obey commands from a supervisory channel, that arrived
> asynchronously to the controller communication.
> My solution there was to use the "select" system call (since this was on Linux)
> to multiplex between the two channels.
> The alternative would have been to wrap each communication endpoint (receive
> and transmit separately) into a thread which`s sole purpose would have been to
> wait. So even in this simple case I would have ended with 5 threads. 2 receive,
> 2 transmit, 1 controller. I think this is a lot of overhead.
Could something like this work ? Have the controller thread wait on select()
and have a separate thread wait on a condition; when the condition occurs, it
writes a character to a pipe which then causes the controller to wake up
from the select().
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk