-/* Copyright (C) 2001 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2001.
#include <stdlib.h>
#include <unistd.h>
-#include "gai_misc.h"
+#include <gai_misc.h>
/* We need this special structure to handle asynchronous I/O. */
}
else if (mode == GAI_WAIT)
{
+#ifndef DONT_NEED_GAI_MISC_COND
pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
+#endif
struct waitlist waitlist[ent];
int oldstate;
for (cnt = 0; cnt < ent; ++cnt)
if (requests[cnt] != NULL)
{
+#ifndef DONT_NEED_GAI_MISC_COND
waitlist[cnt].cond = &cond;
+#endif
waitlist[cnt].next = requests[cnt]->waiting;
waitlist[cnt].counterp = &total;
waitlist[cnt].sigevp = NULL;
pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, &oldstate);
while (total > 0)
- pthread_cond_wait (&cond, &__gai_requests_mutex);
+ {
+#ifdef DONT_NEED_GAI_MISC_COND
+ int result;
+ GAI_MISC_WAIT (result, total, NULL, 1);
+#else
+ pthread_cond_wait (&cond, &__gai_requests_mutex);
+#endif
+ }
/* Now it's time to restore the cancelation state. */
pthread_setcancelstate (oldstate, NULL);
+#ifndef DONT_NEED_GAI_MISC_COND
/* Release the conditional variable. */
if (pthread_cond_destroy (&cond) != 0)
/* This must never happen. */
abort ();
+#endif
}
else
{
for (cnt = 0; cnt < ent; ++cnt)
if (requests[cnt] != NULL)
{
+#ifndef DONT_NEED_GAI_MISC_COND
waitlist->list[cnt].cond = NULL;
+#endif
waitlist->list[cnt].next = requests[cnt]->waiting;
waitlist->list[cnt].counterp = &waitlist->counter;
waitlist->list[cnt].sigevp = &waitlist->sigev;