continuous return?

View: New views
2 Messages — Rating Filter:   Alert me  

continuous return?

by Someone Something :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

--
http://mail.python.org/mailman/listinfo/python-list

Re: continuous return?

by Gabriel Genellina-7 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

En Wed, 04 Nov 2009 00:20:05 -0300, Someone Something  
<fordhaivat@...> 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