
gagsl-py2 at yahoo
Nov 3, 2009, 7:31 PM
Post #2 of 2
(41 views)
Permalink
|
En Wed, 04 Nov 2009 00:20:05 -0300, Someone Something <fordhaivat[at]gmail.com> escribió: > I'm trying to write something related to IRC. The thing is, I have one > thread receiving and another sending. But, how can I keep the caller of > the > recv() function informed about what was last received so that it can all > be > printed out. But, I no idea how I can accomplish this. I was thinking > about > getting one variable that was constantly updated with the latest line > that > was recved and that the variable would be a member of the class so other > functions/classes can access it I don't completely understand your scenario, but since you say you have several threads, a common way to communicate between them is to use a Queue object. Let the receiver thread put() lines into the queue, and the processing thread get() them and do some work. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list
|