Passing an Event from a Thread to its Caller

Mark Hammond mhammond at skippinet.com.au
Tue Jun 3 19:14:36 EDT 2003


Matt Rapoport wrote:
> Mark, thank you very much for your reply.  I think I understand what
> you're saying but the part I'm not so sure about is how do I get my
> thread to trigger the event.
> 
> The thread just creates an object that I wrote called "client". 
> Basically all I want is for the client to pass errors up to my service
> so that I can log them.  Can I set an event in the client code and
> wait for it in the service code?  Or should I alter the client's
> constructor to accept an event so that I can have the service pass the
> event to it?
> 

An event is generally used for synchronization between threads. 
Generally, one thread will "wait" for the event.  Whenever some other 
thread "sets" the event, that first thread will wake up and do whatever 
the event means to it.

Why not simply have your thread log the error?

Mark.





More information about the Python-list mailing list