kernel32/tests: Try harder to empty the pipe for completion notification.

This commit is contained in:
Alexandre Julliard 2015-02-24 21:55:09 +09:00
parent a5ec8bf8b0
commit 5a6cda458d
1 changed files with 6 additions and 9 deletions

View File

@ -2079,20 +2079,17 @@ static void test_readfileex_pending(void)
ok(completion_lpoverlapped == &overlapped, "completion called with wrong overlapped pointer\n");
/* free up some space in the pipe */
ret = ReadFile(client, read_buf, sizeof(read_buf), &num_bytes, NULL);
ok(ret == TRUE, "ReadFile failed\n");
ok(completion_called == 0, "completion routine called during ReadFile\n");
wait = WaitForSingleObjectEx(event, 0, TRUE);
ok(wait == WAIT_IO_COMPLETION || wait == WAIT_OBJECT_0, "WaitForSingleObject returned %x\n", wait);
if (wait == WAIT_TIMEOUT)
for (i=0; i<256; i++)
{
ret = ReadFile(client, read_buf, sizeof(read_buf), &num_bytes, NULL);
ok(ret == TRUE, "ReadFile failed\n");
ok(completion_called == 0, "completion routine called during ReadFile\n");
wait = WaitForSingleObjectEx(event, 0, TRUE);
ok(wait == WAIT_IO_COMPLETION || wait == WAIT_OBJECT_0, "WaitForSingleObject returned %x\n", wait);
ok(wait == WAIT_IO_COMPLETION || wait == WAIT_OBJECT_0 || wait == WAIT_TIMEOUT,
"WaitForSingleObject returned %x\n", wait);
if (wait != WAIT_TIMEOUT) break;
}
ok(completion_called == 1, "completion routine not called\n");