I've been trying to find a solution to the following problem...

I have two message queues in shared memory, one for incoming messages, one
for outgoing. I have a thread that gets kicked off for processing the
incoming messages as they appear on the queue.  This thread waits for a
particular event, which is signalled by another thread (see below) as it
populates the incoming message queue.

The outgoing message queue is populated by *any* thread through shared memory
access.

A second thread is started that opens and reads/writes to a local device
(using standard file IO).  So any messages appearing on the outgoing message
queue are written, and anything from the device added to the incoming queue.

My problem is that I'd like to use an ns_cond/ns_event to inform this second
thread that messages are available to be written to the device.  But I also
want to use a fileevent callback to read data off the device when its
available and populate the incoming message queue.  As far as I can tell,
there is no clean way to achieve both these things, and I'm coming to the
conclusion that I'll simply have to use a vwait and a background event that
periodically checks the shared memory for changes.  Horrible.

Can someone give me some pointers/solution please?

Many thanks,
Pete.

--
Peter Harper
[EMAIL PROTECTED]
http://www.open-msg.com/
--

Reply via email to