Threads and Event objects

Matthew Hawkins matthew at topic.com.au
Fri Jun 15 00:59:47 EDT 2001


I have a class that fires off some threads to do some i/o, and I'm trying
to have it collate the results.  I send in a Conditional variable to
control access to the data buffer, and an Event variable so the thread
can signal when there's some data to come pick up.

The trouble I have is that I can't figure out how to determine which thread
signalled the event, therefore I cannot make the main class call a method
on that thread to go pick up the data.  I would have expected the Event
class to hold some metadata like the name of the thread that raised it.

I'm going to try the reverse now - pass in a function from the main class
to the constructor of each thread object and have the threads call that,
but that just seems to be an ugly hack.

How do other people do similar things?

-- 
Matt



More information about the Python-list mailing list