Message139573
| Author |
vstinner |
| Recipients |
eckhardt, pitrou, rhettinger, vstinner |
| Date |
2011年07月01日.12:48:12 |
| SpamBayes Score |
1.9517445e-07 |
| Marked as misclassified |
No |
| Message-id |
<1309524493.62.0.845980102531.issue12459@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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. |
|
History
|
|---|
| 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 |
|