Commit 81244f1d authored by Pekka Pessi's avatar Pekka Pessi

Fixed su_wait() with 0 wait objects in windows.

darcs-hash:20060215153047-65a35-c474925fb7992e0cb4b99800611bddf44d3ca2b2.gz
parent 2f808c37
......@@ -223,8 +223,6 @@ int test_sendrecv(void)
n = send(a, "", 0, 0); TEST(n, 0);
n = su_vsend(a, sv, 3, 0, NULL, 0); TEST(n, 8 + 8 + 6);
shutdown(a, 2);
su_close(a);
{
su_wait_t w[1] = { SU_WAIT_INIT };
......@@ -234,10 +232,22 @@ int test_sendrecv(void)
TEST(su_wait(w, 0, 500), SU_WAIT_TIMEOUT);
TEST(su_wait(w, 1, 500), 0);
TEST(su_wait_events(w, s), SU_WAIT_IN);
TEST(su_getmsgsize(s), 8 + 8 + 6);
n = su_vrecv(s, rv, 3, 0, NULL, NULL); TEST(n, 8 + 8 + 6);
TEST(su_wait(w, 1, 100), SU_WAIT_TIMEOUT);
shutdown(a, 2);
TEST(su_wait(w, 1, 100), 0);
TEST_1(su_wait_events(w, s) & SU_WAIT_HUP);
su_wait_destroy(w);
}
TEST(su_getmsgsize(s), 8 + 8 + 6);
n = su_vrecv(s, rv, 3, 0, NULL, NULL); TEST(n, 8 + 8 + 6);
su_close(a);
su_close(l);
su_close(s);
......
......@@ -200,7 +200,12 @@ int su_wait_destroy(su_wait_t *waitobj)
int su_wait(su_wait_t waits[], unsigned n, su_duration_t timeout)
{
#if SU_HAVE_WINSOCK
DWORD i = WSAWaitForMultipleEvents(n, waits, FALSE, timeout, FALSE);
DWORD i;
if (n > 0)
i = WSAWaitForMultipleEvents(n, waits, FALSE, timeout, FALSE);
else
return Sleep(timeout), SU_WAIT_TIMEOUT;
if (i == WSA_WAIT_TIMEOUT)
return SU_WAIT_TIMEOUT;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment