Asyncore select statement problem

Gabriel Genellina gagsl-py at
Fri Jan 19 20:50:26 CET 2007

At Friday 19/1/2007 14:42, JamesHoward wrote:

>Thank you for the responses.  I have learned considerably more about
>how Asyncore works because of it.
>The problem that I see is that Asyncore's poll function does not seem
>to be thread safe.  From what I can tell, I am calling
>dispatcher.close() properly and the dispatchers are removed from
>asyncore's global map (all except the server itself).  However, it
>seems like the error happens when the poll function gets the file
>descriptors to run select on and then the thread ticks and removes them
>from the global map.  After this the select call is made, but the file
>descriptors are not valid anymore.
>I guess I have two questions as a result.  First, is this a problem
>that anyone else has had and second is there a fix for it?  I have
>tried looking for Asyncore thread safe topics in Google, but without
>much luck.  If needed I think making the poll function atomic in the
>asyncore module might fix this problem, but I wanted to see what other
>people thought first.

Usually asyncore is used with only one thread - that's one of the 
reasons of using it btw. You can spawn other working threads, but 
they don't usually interact with the networking stuff directly.

Gabriel Genellina
Softlab SRL 


Preguntá. Respondé. Descubrí. 
Todo lo que querías saber, y lo que ni imaginabas, 
está en Yahoo! Respuestas (Beta). 
¡Probalo ya! 

More information about the Python-list mailing list