summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorJan Dubois <jand@activestate.com>2006-03-16 08:11:48 -0800
committerSteve Peters <steve@fisharerojo.org>2006-03-17 04:19:01 +0000
commitc71e9bcc0530c131e1aaebb9356d24631b39217c (patch)
treeaab3a9f6cd9a236571c6e9844af359154896e74c /win32
parentd83d022c5cbb9289f9c20b08fe42428075463c25 (diff)
downloadperl-c71e9bcc0530c131e1aaebb9356d24631b39217c.tar.gz
win32_async_check() can loop indefinitely; 5.8.8 regression
Message-ID: <02ab01c64957$62142e70$6062a8c0@candy> p4raw-id: //depot/perl@27527
Diffstat (limited to 'win32')
-rw-r--r--win32/win32.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/win32/win32.c b/win32/win32.c
index 0f67ba12fb..e2b6e0bb15 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -1784,8 +1784,17 @@ win32_async_check(pTHX)
w32_poll_count = 0;
- if (hwnd == INVALID_HANDLE_VALUE)
+ if (hwnd == INVALID_HANDLE_VALUE) {
+ /* Call PeekMessage() to mark all pending messages in the queue as "old".
+ * This is necessary when we are being called by win32_msgwait() to
+ * make sure MsgWaitForMultipleObjects() stops reporting the same waiting
+ * message over and over. An example how this can happen is when
+ * Perl is calling win32_waitpid() inside a GUI application and the GUI
+ * is generating messages before the process terminated.
+ */
+ PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE|PM_NOYIELD);
return 1;
+ }
/* Passing PeekMessage -1 as HWND (2nd arg) only get PostThreadMessage() messages
* and ignores window messages - should co-exist better with windows apps e.g. Tk