diff options
author | Ulrich Drepper <drepper@redhat.com> | 2006-08-03 08:17:20 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2006-08-03 08:17:20 +0000 |
commit | f1762c0c4b3ba91073f82da02a16d8ee29ed7444 (patch) | |
tree | dd3ed0e40f1cb6a2560dfba1fd300cfe98be28ba /resolv/gai_misc.c | |
parent | NPTL specific definitions for async name lookup. (diff) | |
download | glibc-f1762c0c4b3ba91073f82da02a16d8ee29ed7444.tar.gz glibc-f1762c0c4b3ba91073f82da02a16d8ee29ed7444.tar.bz2 glibc-f1762c0c4b3ba91073f82da02a16d8ee29ed7444.zip |
[BZ #2978]
2006-08-03 Ulrich Drepper <drepper@redhat.com>
* rt/Makefile (tests): Add tst-clock2.
* rt/tst-clock2.c: New file.
[BZ #2978]
* resolv/gai_notify.c (__gai_notify_only): Copy memory for thread
function and its parameters and pass it to new thread.
(__gai_notify): Add support for alternative waiting for completion.
* resolv/gai_suspend.c (gai_suspend): Add support for alternative
waiting for completion.
* resolv/getaddrinfo_a.c: Likewise.
* resolv/gai_misc.h (struct waitlist): Don't add cond if alternative
waiting for completion is used.
* resolv/gai_misc.c: Allow overwriting code to start helper thread.
* resolv/gai_cancel.c: Include <gai_misc.h> not "gai_misc.h".
* resolv/gai_error.c: Likewise.
* resolv/gai_sigqueue.c: Likewise.
* hurd/getdport.c (__detdport): Don't return EBADF; instead set
errno to EBADF and return MACH_PORT_NULL.
* posix/Makefile (CFLAGS-waitid.c): Add -fasynchronous-unwind-tables.
Diffstat (limited to 'resolv/gai_misc.c')
-rw-r--r-- | resolv/gai_misc.c | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/resolv/gai_misc.c b/resolv/gai_misc.c index b3334f38ef..2eec0f529d 100644 --- a/resolv/gai_misc.c +++ b/resolv/gai_misc.c @@ -1,4 +1,4 @@ -/* 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. @@ -23,10 +23,31 @@ #include <stdlib.h> #include <sys/time.h> -#include "gai_misc.h" +#include <gai_misc.h> +#ifndef gai_create_helper_thread +# define gai_create_helper_thread __gai_create_helper_thread + +extern inline int +__gai_create_helper_thread (pthread_t *threadp, void *(*tf) (void *), + void *arg) +{ + pthread_attr_t attr; + + /* Make sure the thread is created detached. */ + pthread_attr_init (&attr); + pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED); + + int ret = pthread_create (threadp, &attr, tf, arg); + + (void) pthread_attr_destroy (&attr); + return ret; +} +#endif + + /* Pool of request list entries. */ static struct requestlist **pool; @@ -229,16 +250,11 @@ __gai_enqueue_request (struct gaicb *gaicbp) if (nthreads < optim.gai_threads && idle_thread_count == 0) { pthread_t thid; - pthread_attr_t attr; newp->running = 1; - /* Make sure the thread is created detached. */ - pthread_attr_init (&attr); - pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED); - /* Now try to start a thread. */ - if (pthread_create (&thid, &attr, handle_requests, newp) == 0) + if (gai_create_helper_thread (&thid, handle_requests, newp) == 0) /* We managed to enqueue the request. All errors which can happen now can be recognized by calls to `gai_error'. */ ++nthreads; |