Threading.Condition problem

Gabriel Rossetti gabriel.rossetti at arimaz.com
Fri Jul 10 07:09:28 EDT 2009


The previous msg w/ attached code is the wrong code, please use the code 
attached to this msg, thank you and sorry for this.

Gabriel


Gabriel Rossetti wrote:
> Hello everyone,
>
> I wrote a small example that listens for xmpp msgs in a thread. The 
> main program calls a function that blocks (using Condition.wait) until 
> a msg has been received and then returns the msg. When a msg arrives, 
> it is put in a variable in the thread's object, it then calls the 
> notify() attr on the Condition object. For some reason, this doesn't 
> work, the thread gets the msg, tries to notify the Condition object, 
> fails because the lock has not been acquired yet and blocks. I tried 
> ignoring the failure, thinking that since it has not been acquired yet 
> then when it is, it will get the msg right away and never call 
> Condition.wait, thus not causing any problems, but this does not work 
> either. Does someone know what I am doing wrong? I attached the code 
> to this msg.
>
> Thank you,
> Gabriel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_xmpp.py
Type: text/x-python
Size: 1878 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20090710/e8c8f701/attachment-0001.py>


More information about the Python-list mailing list