1 /* Copyright (C) 2006-2018 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
22 #define gai_start_notify_thread __gai_start_notify_thread
23 #define gai_create_helper_thread __gai_create_helper_thread
26 __gai_start_notify_thread (void)
30 int sigerr
__attribute__ ((unused
));
31 sigerr
= pthread_sigmask (SIG_SETMASK
, &ss
, NULL
);
32 assert_perror (sigerr
);
36 __gai_create_helper_thread (pthread_t
*threadp
, void *(*tf
) (void *),
41 /* Make sure the thread is created detached. */
42 pthread_attr_init (&attr
);
43 pthread_attr_setdetachstate (&attr
, PTHREAD_CREATE_DETACHED
);
45 /* The helper thread needs only very little resources. */
46 (void) pthread_attr_setstacksize (&attr
, 0x10000);
48 /* Block all signals in the helper thread. To do this thoroughly we
49 temporarily have to block all signals here. */
53 int sigerr
__attribute__ ((unused
));
54 sigerr
= pthread_sigmask (SIG_SETMASK
, &ss
, &oss
);
55 assert_perror (sigerr
);
57 int ret
= pthread_create (threadp
, &attr
, tf
, arg
);
59 /* Restore the signal mask. */
60 sigerr
= pthread_sigmask (SIG_SETMASK
, &oss
, NULL
);
61 assert_perror (sigerr
);
63 (void) pthread_attr_destroy (&attr
);
67 #include_next <gai_misc.h>