[Python-bugs-list] [ python-Bugs-581232 ] [Windows] Can not interrupt time.sleep()
noreply@sourceforge.net
noreply@sourceforge.net
Sun, 14 Jul 2002 07:46:16 -0700
Bugs item #581232, was opened at 2002-07-14 17:59
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=581232&group_id=5470
Category: Python Library
Group: Platform-specific
Status: Open
Resolution: None
Priority: 5
Submitted By: Mark Hammond (mhammond)
Assigned to: Tim Peters (tim_one)
Summary: [Windows] Can not interrupt time.sleep()
Initial Comment:
As nagged by Tim - time.sleep(10000) can not be
interrupted by Ctrl+C on Windows. Attaching a patch to
fix this.
----------------------------------------------------------------------
>Comment By: Mark Hammond (mhammond)
Date: 2002-07-15 00:46
Message:
Logged In: YES
user_id=14198
... need uninterrupted sleep <wink>. Please ignore the
Ctrl+Break comments - I had my bugs mixed up. Rest is still
valid tho.
----------------------------------------------------------------------
Comment By: Mark Hammond (mhammond)
Date: 2002-07-15 00:38
Message:
Logged In: YES
user_id=14198
Here we go - a better patch. This delivers the exact same
multi-threaded semantics as my Linux build.
Re Ctrl+Break - no argument from me - my "if deemed broken"
was meant to imply that! Win9x Ctrl+Break must be the same
as Win2k - I seemed to recall on Win9x it behaved like a
Ctrl+C. No 9x even booted to check, and I don't really care
<wink>
FWIW, my test script:
import time, threading, thread
def sleeper():
try:
time.sleep(30)
finally:
msg = "Thread %d dieing" % (thread.get_ident(),)
print msg
threads=[]
for i in range(2):
t=threading.Thread(target=sleeper)
t.start()
threads.append(t)
print "sleeping"
try:
time.sleep(30)
finally:
print "waiting"
[t.join for t in threads]
print "final short sleep"
time.sleep(2)
----------------------------------------------------------------------
Comment By: Mark Hammond (mhammond)
Date: 2002-07-14 18:05
Message:
Logged In: YES
user_id=14198
Poo - not a thread-safe patch. I will think about this some
more tomorrow.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=581232&group_id=5470