duplex events

  • Thread starter Thread starter bill
  • Start date Start date
B

bill

I need two classes that can signal each other. One class reads data and
signals the other when data is available. The other writes data to a buffer
then signals the other class to write it out.


I have seen a number of examples of events. I have seen none that goes both
ways.

Is this possible, and not overly complicated?

Thanks,
Bill
 
first of all, in ya typical consumer and producer situition, i dont think
firing events between each other sounds like a better idea (IMO).

CLASSIC implementation is:
producer notify comsumer buffer ready
-------------> consumer do some magic (buffer locked, producer
automatically suspended awaiting for lock release)
--------------------------> consumer finishes (lock released)
-------------------------------------->producer automaticlly restarted

hope this helps
 
No not really. I'll be a bit more specific.

I have a thread running managing the serial port. I have another thread
running using the serial port thread.


When the serial port gets a specific number of bits it sets an event to let
the user thread know there is a data message in the buffer.


When the user thread wants to write data out the serial port it loads a
buffer with its data and sets an event to have the serial port write out the
data.

The reason for this is portability. I want do the same thing with ethernet
and usb.
The user thread works identically with thatever I/O port thread it is using.

I don't think this is a standard consumer-producer problem. But maybe I'm
wrong.

Thanks,
Bill
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

IOCTL and name events stuff 6
ThreadPool and WaitHandle 1
Mesh Networking in UK 9
Is there a way ? 4
Asynchronous event 2
Use of event handling 6
I/O buffering 4
Follow up 6

Back
Top