[PATCH 10/12] user32/tests: Synchronize with other thread between SendMessage calls.
Rémi Bernon
rbernon at codeweavers.com
Tue Nov 12 14:42:03 CST 2019
This sometimes fails on Windows because we check the queue status before
the other thread second call to SendMessage has been made (or received).
Adding a synchronization here could help, although there should not be
any long delay as we already seen the first SendMessage call -asserted
by the send_message_1 sequence.
https://testbot.winehq.org/JobDetails.pl?Key=59890#k106
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
dlls/user32/tests/msg.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c
index c73f9ac36b9..593a1e65047 100644
--- a/dlls/user32/tests/msg.c
+++ b/dlls/user32/tests/msg.c
@@ -17475,6 +17475,7 @@ static DWORD WINAPI SendMessage_thread_1(void *param)
trace("thread: call SendMessage\n");
SendMessageA(wnd_event->hwnd, WM_USER+2, 0, 0);
+ SetEvent(wnd_event->stop_event);
trace("thread: call SendMessage\n");
SendMessageA(wnd_event->hwnd, WM_USER+3, 0, 0);
@@ -17501,6 +17502,7 @@ static DWORD WINAPI SendMessage_thread_2(void *param)
trace("thread: call SendMessage\n");
SendMessageA(wnd_event->hwnd, WM_USER+2, 0, 0);
+ SetEvent(wnd_event->stop_event);
trace("thread: call SendMessage\n");
SendMessageA(wnd_event->hwnd, WM_USER+3, 0, 0);
@@ -17517,6 +17519,7 @@ static void test_SendMessage_other_thread(int thread_n)
MSG msg;
wnd_event.start_event = CreateEventA(NULL, 0, 0, NULL);
+ wnd_event.stop_event = CreateEventA(NULL, 0, 0, NULL);
wnd_event.hwnd = CreateWindowExA(0, "TestWindowClass", NULL, WS_OVERLAPPEDWINDOW,
100, 100, 200, 200, 0, 0, 0, NULL);
@@ -17551,6 +17554,10 @@ static void test_SendMessage_other_thread(int thread_n)
DispatchMessageA(&msg);
ok_sequence(send_message_1, "SendMessage from other thread 1", thread_n == 2);
+ ret = WaitForSingleObject(wnd_event.stop_event, 100);
+ todo_wine_if (thread_n == 2)
+ ok(ret == WAIT_OBJECT_0, "WaitForSingleObject failed, ret:%x\n", ret);
+
/* intentionally yield */
MsgWaitForMultipleObjects(0, NULL, FALSE, 100, qs_all_input);
@@ -17587,6 +17594,9 @@ todo_wine_if (thread_n == 2)
flush_events();
flush_sequence();
+
+ CloseHandle(wnd_event.start_event);
+ CloseHandle(wnd_event.stop_event);
}
static LRESULT CALLBACK insendmessage_wnd_proc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
--
2.24.0.rc2
More information about the wine-devel
mailing list