diff options
author | Tomasz Konojacki <me@xenu.pl> | 2018-07-15 02:33:16 +0200 |
---|---|---|
committer | Tony Cook <tony@develop-help.com> | 2018-08-01 16:42:30 +1000 |
commit | bbc9927bf24edbd6398f6decb015f1b9369455a0 (patch) | |
tree | 86f9b8cc90be6d19f0a7efa7605c928895e4e22e /win32 | |
parent | 3d5e9c119db6b727684fe75dfcfe5831c4351bec (diff) | |
download | perl-bbc9927bf24edbd6398f6decb015f1b9369455a0.tar.gz |
win32: fix argumentless sleep()
Before this commit, pause() was implemented as a macro calling
win32_sleep((32767L << 16) + 32767), which was causing the following
problems with argumentless sleep():
- it was sleeping for 4262198 seconds (~50 days) instead of forever
- it was triggering "sleep(2147450879) too large" warning
This commit implements pause() as a proper function which calls
win32_msgwait() with an INFINITE timeout.
[perl #133376]
Diffstat (limited to 'win32')
-rw-r--r-- | win32/perlhost.h | 2 | ||||
-rw-r--r-- | win32/win32.c | 8 | ||||
-rw-r--r-- | win32/win32iop.h | 3 |
3 files changed, 11 insertions, 2 deletions
diff --git a/win32/perlhost.h b/win32/perlhost.h index 3260f62a02..6dd269efa7 100644 --- a/win32/perlhost.h +++ b/win32/perlhost.h @@ -1605,7 +1605,7 @@ PerlProcKillpg(struct IPerlProc* piPerl, int pid, int sig) int PerlProcPauseProc(struct IPerlProc* piPerl) { - return win32_sleep((32767L << 16) + 32767); + return win32_pause(); } PerlIO* diff --git a/win32/win32.c b/win32/win32.c index c7656c631b..769a0e11b3 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -2455,6 +2455,14 @@ win32_sleep(unsigned int t) return win32_msgwait(aTHX_ 0, NULL, t * 1000, NULL) / 1000; } +DllExport int +win32_pause(void) +{ + dTHX; + win32_msgwait(aTHX_ 0, NULL, INFINITE, NULL); + return -1; +} + DllExport unsigned int win32_alarm(unsigned int sec) { diff --git a/win32/win32iop.h b/win32/win32iop.h index 842bc073be..a9235d3595 100644 --- a/win32/win32iop.h +++ b/win32/win32iop.h @@ -128,6 +128,7 @@ DllExport char* win32_getenv(const char *name); DllExport int win32_putenv(const char *name); DllExport unsigned win32_sleep(unsigned int); +DllExport int win32_pause(void); DllExport int win32_times(struct tms *timebuf); DllExport unsigned win32_alarm(unsigned int sec); DllExport char* win32_longpath(char *path); @@ -429,7 +430,7 @@ END_EXTERN_C */ #define pipe(fd) win32_pipe((fd), 512, O_BINARY) -#define pause() win32_sleep((32767L << 16) + 32767) +#define pause win32_pause #define sleep win32_sleep #define times win32_times #define ioctl win32_ioctl |