Ben,

Thanks very much for your reply. Everything you say is true, and the system can 
certainly be made to work (and without the performance problem I described) 
using only Condition variables.

I think the correct version of my pseudo-code becomes:

def sender():
     while alive():
          wait_for_my_data_from_hardware()
           with condition:
                send_data_to_receiver()  # I think this has to be done inside 
the lock on the Condition
                condition.raise()

def receiver():
     while alive():
         while data available:
                 receive_all_data_from_sender()
                 process_data()
         with condition:  # only sleep when we have nothing to do
                 condition.wait()




_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to