[PATCH v3 6/6] user32/tests: Fix an intermittent failure.
Zebediah Figura
z.figura12 at gmail.com
Sun Mar 26 17:41:36 CDT 2017
Rarely, WM_USER+3 will be sent before GetMessage() finishes executing,
causing GetMessage() to process it as well before returning.
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
dlls/user32/tests/msg.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index 9618948..1a96c98 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -16268,6 +16268,7 @@ static DWORD WINAPI SendMessage_thread_1(void *param)
trace("thread: starting\n");
WaitForSingleObject(wnd_event->start_event, INFINITE);
+ ResetEvent(wnd_event->start_event);
trace("thread: call PostMessage\n");
PostMessageA(wnd_event->hwnd, WM_USER, 0, 0);
@@ -16278,6 +16279,8 @@ static DWORD WINAPI SendMessage_thread_1(void *param)
trace("thread: call SendMessage\n");
SendMessageA(wnd_event->hwnd, WM_USER+2, 0, 0);
+ WaitForSingleObject(wnd_event->start_event, INFINITE);
+
trace("thread: call SendMessage\n");
SendMessageA(wnd_event->hwnd, WM_USER+3, 0, 0);
@@ -16290,6 +16293,7 @@ static DWORD WINAPI SendMessage_thread_2(void *param)
trace("thread: starting\n");
WaitForSingleObject(wnd_event->start_event, INFINITE);
+ ResetEvent(wnd_event->start_event);
trace("thread: call PostMessage\n");
PostMessageA(wnd_event->hwnd, WM_USER, 0, 0);
@@ -16307,6 +16311,8 @@ static DWORD WINAPI SendMessage_thread_2(void *param)
trace("thread: call SendMessage\n");
SendMessageA(wnd_event->hwnd, WM_USER+2, 0, 0);
+ WaitForSingleObject(wnd_event->start_event, INFINITE);
+
Sleep(50);
trace("thread: call SendMessage\n");
@@ -16358,6 +16364,8 @@ static void test_SendMessage_other_thread(int thread_n)
DispatchMessageA(&msg);
ok_sequence(send_message_1, "SendMessage from other thread 1", thread_n == 2);
+ SetEvent(wnd_event.start_event);
+
/* intentionally yield */
MsgWaitForMultipleObjects(0, NULL, FALSE, 100, qs_all_input);
--
2.7.4
More information about the wine-patches
mailing list