Message139573
Tim Lesher on python-dev: "On the Windows side, Sleep(-1) as "infinite" is correct and documented:
http://msdn.microsoft.com/en-us/library/ms686298(v=vs.85).aspx"
Wine defines INFINITE using "#define INFINITE 0xFFFFFFFF":
http://source.winehq.org/source/include/winbase.h
-1 becomes INFINITE because of an integer overflow (because of a cast from double to *unsigned* long). time.sleep(-2) doesn't sleep for an infinite time, but for more than 136 years (maybe more in 64 bits?):
>>> print(datetime.timedelta(seconds=-2 & 0xFFFFFFFF))
49710 days, 6:28:14
What is the usecase of Sleep(INFINITE)? Wait a signal or wait another event?
Because other platforms don't support the INFINITE timeout, I suggest to always raise an error to have the same behaviour on all platforms.
On POSIX, you can use pause(), sigwait(), select() or other functions to wait a signal for example. If we something something like that on Windows, we need a new function, but not a magic time.sleep(-1) please. |
|
Date |
User |
Action |
Args |
2011-07-01 12:48:13 | vstinner | set | recipients:
+ vstinner, rhettinger, pitrou, eckhardt |
2011-07-01 12:48:13 | vstinner | set | messageid: <1309524493.62.0.845980102531.issue12459@psf.upfronthosting.co.za> |
2011-07-01 12:48:13 | vstinner | link | issue12459 messages |
2011-07-01 12:48:12 | vstinner | create | |
|