Update copyright dates with scripts/update-copyrights.
[glibc.git] / nptl / createthread.c
blob2c1ea4783c3edef94f960098b8ff56ece95cdc07
1 /* Low-level thread creation for NPTL. Stub version.
2 Copyright (C) 2014-2015 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
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.
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.
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/>. */
19 /* See the comments in pthread_create.c for the requirements for these
20 two macros and the create_thread function. */
22 #define START_THREAD_DEFN \
23 static void __attribute__ ((noreturn)) start_thread (void)
24 #define START_THREAD_SELF THREAD_SELF
26 static int
27 create_thread (struct pthread *pd, const struct pthread_attr *attr,
28 bool stopped_start, STACK_VARIABLES_PARMS, bool *thread_ran)
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. */
33 pd->stopped_start = stopped_start;
34 if (__glibc_unlikely (stopped_start))
35 /* We make sure the thread does not run far by forcing it to get a
36 lock. We lock it here too so that the new thread cannot continue
37 until we tell it to. */
38 lll_lock (pd->lock, LLL_PRIVATE);
40 return ENOSYS;
42 /* It's started now, so if we fail below, we'll have to cancel it
43 and let it clean itself up. */
44 *thread_ran = true;
46 return 0;