1 /* Copyright (C) 2003-2017 Free Software Foundation, Inc.
3 The GNU C Library is free software; you can redistribute it and/or
4 modify it under the terms of the GNU Lesser General Public
5 License as published by the Free Software Foundation; either
6 version 2.1 of the License, or (at your option) any later version.
8 The GNU C Library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Lesser General Public License for more details.
13 You should have received a copy of the GNU Lesser General Public
14 License along with the GNU C Library; if not, see
15 <http://www.gnu.org/licenses/>. */
18 #include <tcb-offsets.h>
20 # include <pthreadP.h>
23 #if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
25 # ifdef IS_IN_libpthread
26 # define __local_multiple_threads __pthread_multiple_threads
27 # elif !defined NOT_IN_libc
28 # define __local_multiple_threads __libc_multiple_threads
31 # if defined IS_IN_libpthread || !defined NOT_IN_libc
32 extern int __local_multiple_threads attribute_hidden
;
33 # define SINGLE_THREAD_P __builtin_expect (__local_multiple_threads == 0, 1)
35 /* There is no __local_multiple_threads for librt, so use the TCB. */
36 # define SINGLE_THREAD_P \
37 __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
38 header.multiple_threads) == 0, 1)
43 /* For rtld, et cetera. */
44 # define SINGLE_THREAD_P 1
45 # define NO_CANCELLATION 1
49 #define RTLD_SINGLE_THREAD_P \
50 __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
51 header.multiple_threads) == 0, 1)