problem on multi-threading

Chris Kaynor ckaynor at zindagigames.com
Fri Jul 25 18:08:01 CEST 2014


On Fri, Jul 25, 2014 at 12:45 AM, 水静流深 <1248283536 at qq.com> wrote:

>
> never quit from the thread ,why?
>

I am going to guess that you can actually run code  in the interpreter
here. When printing from threads, the prompt will end up in the wrong place
as the prompt is printed in the main thread. Similarly, there is a (decent)
chance that the prints will be done out-of-order (multiple "<Thread..."
lines or URLs next to each other or on the same line). The odds that such
behavior will occur will increase as the work become more complex and more
threads are created. All of this can be resolved by manually using the
locking provided in the threading module.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20140725/d65fb50d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 08221DA3 at 7B7BB14B.140BD253.PNG
Type: application/octet-stream
Size: 24971 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20140725/d65fb50d/attachment.obj>


More information about the Python-list mailing list