Re: Why does this hang sometimes?

2012-04-12 Thread Jesse Jaggars
Possibly. I wonder what the difference(s) is(are)?

On Sat, Apr 7, 2012 at 5:54 PM, Jason Friedman ja...@powerpull.net wrote:
 I am just playing around with threading and subprocess and found that
 the following program will hang up and never terminate every now and
 again.

 import threading
 import subprocess
 import time

 def targ():
    p = subprocess.Popen([/bin/sleep, 2])
    while p.poll() is None:
        time.sleep(1)

 t1 = threading.Thread(target=targ)
 t2 = threading.Thread(target=targ)
 t1.start()
 t2.start()

 t1.join()
 t2.join()


 I found this bug, and while it sounds similar it seems that it was
 closed during python 2.5 (I'm using 2.7.2):
 http://bugs.python.org/issue1404925

 I can confirm hanging on my installation of 2.7.2.  I also ran this
 code 100 times on 3.2.2 without experiencing a hang.  Is version 3.x a
 possibility for you?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Why does this hang sometimes?

2012-04-07 Thread Jason Friedman
 I am just playing around with threading and subprocess and found that
 the following program will hang up and never terminate every now and
 again.

 import threading
 import subprocess
 import time

 def targ():
    p = subprocess.Popen([/bin/sleep, 2])
    while p.poll() is None:
        time.sleep(1)

 t1 = threading.Thread(target=targ)
 t2 = threading.Thread(target=targ)
 t1.start()
 t2.start()

 t1.join()
 t2.join()


 I found this bug, and while it sounds similar it seems that it was
 closed during python 2.5 (I'm using 2.7.2):
 http://bugs.python.org/issue1404925

I can confirm hanging on my installation of 2.7.2.  I also ran this
code 100 times on 3.2.2 without experiencing a hang.  Is version 3.x a
possibility for you?
-- 
http://mail.python.org/mailman/listinfo/python-list


Why does this hang sometimes?

2012-04-04 Thread Jesse Jaggars
I am just playing around with threading and subprocess and found that
the following program will hang up and never terminate every now and
again.

import threading
import subprocess
import time

def targ():
   p = subprocess.Popen([/bin/sleep, 2])
   while p.poll() is None:
       time.sleep(1)

t1 = threading.Thread(target=targ)
t2 = threading.Thread(target=targ)
t1.start()
t2.start()

t1.join()
t2.join()


I found this bug, and while it sounds similar it seems that it was
closed during python 2.5 (I'm using 2.7.2):
http://bugs.python.org/issue1404925

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