]> git.ipfire.org Git - thirdparty/glibc.git/blob - nptl/createthread.c
20b7bfa4d1349d1f49dece32ecd373671489691b
[thirdparty/glibc.git] / nptl / createthread.c
1 /* Low-level thread creation for NPTL. Stub version.
2 Copyright (C) 2014-2019 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
18
19 /* See the comments in pthread_create.c for the requirements for these
20 two macros and the create_thread function. */
21
22 #define START_THREAD_DEFN \
23 static void __attribute__ ((noreturn)) start_thread (void)
24 #define START_THREAD_SELF THREAD_SELF
25
26 static int
27 create_thread (struct pthread *pd, const struct pthread_attr *attr,
28 bool *stopped_start, STACK_VARIABLES_PARMS, bool *thread_ran)
29 {
30 /* If the implementation needs to do some tweaks to the thread after
31 it has been created at the OS level, it can set STOPPED_START here. */
32
33 pd->stopped_start = *stopped_start;
34 if (__glibc_unlikely (*stopped_start))
35 /* See CONCURRENCY NOTES in nptl/pthread_create.c. */
36 lll_lock (pd->lock, LLL_PRIVATE);
37
38 return ENOSYS;
39
40 /* It's started now, so if we fail below, we'll have to cancel it
41 and let it clean itself up. */
42 *thread_ran = true;
43
44 return 0;
45 }