mirror of
git://sourceware.org/git/glibc.git
synced 2025-03-01 13:17:19 +08:00
This patch adds the thrd_* definitions from C11 threads (ISO/IEC 9899:2011), more specifically thrd_create, thrd_curent, rhd_detach, thrd_equal, thrd_exit, thrd_join, thrd_sleep, thrd_yield, and required types. Mostly of the definitions are composed based on POSIX conterparts, such as thrd_t (using pthread_t). For thrd_* function internally direct POSIX pthread call are used with the exceptions: 1. thrd_start uses pthread_create internal implementation, but changes how to actually calls the start routine. This is due the difference in signature between POSIX and C11, where former return a 'void *' and latter 'int'. To avoid calling convention issues due 'void *' to int cast, routines from C11 threads are started slight different than default pthread one. Explicit cast to expected return are used internally on pthread_create and the result is stored back to void also with an explicit cast. 2. thrd_sleep uses nanosleep internal direct syscall to avoid clobbering errno and to handle expected standard return codes. It is a cancellation entrypoint to be consistent with both thrd_join and cnd_{timed}wait. 3. thrd_yield also uses internal direct syscall to avoid errno clobbering. Checked with a build for all major ABI (aarch64-linux-gnu, alpha-linux-gnu, arm-linux-gnueabi, i386-linux-gnu, ia64-linux-gnu, m68k-linux-gnu, microblaze-linux-gnu [1], mips{64}-linux-gnu, nios2-linux-gnu, powerpc{64le}-linux-gnu, s390{x}-linux-gnu, sparc{64}-linux-gnu, and x86_64-linux-gnu). Also ran a full check on aarch64-linux-gnu, x86_64-linux-gnu, i686-linux-gnu, arm-linux-gnueabhf, and powerpc64le-linux-gnu. [BZ #14092] * conform/Makefile (conformtest-headers-ISO11): Add threads.h. (linknamespace-libs-ISO11): Add libpthread.a. * conform/data/threads.h-data: New file: add C11 thrd_* types and functions. * include/stdc-predef.h (__STDC_NO_THREADS__): Remove definition. * nptl/Makefile (headers): Add threads.h. (libpthread-routines): Add new C11 thread thrd_create, thrd_current, thrd_detach, thrd_equal, thrd_exit, thrd_join, thrd_sleep, and thrd_yield. * nptl/Versions (libpthread) [GLIBC_2.28]): Add new C11 thread thrd_create, thrd_current, thrd_detach, thrd_equal, thrd_exit, thrd_join, thrd_sleep, and thrd_yield symbols. * nptl/descr.h (struct pthread): Add c11 field. * nptl/pthreadP.h (ATTR_C11_THREAD): New define. * nptl/pthread_create.c (START_THREAD_DEFN): Call C11 thread start routine with expected function prototype. (__pthread_create_2_1): Add C11 threads check based on attribute value. * sysdeps/unix/sysdep.h (INTERNAL_SYSCALL_CANCEL): New macro. * nptl/thrd_create.c: New file. * nptl/thrd_current.c: Likewise. * nptl/thrd_detach.c: Likewise. * nptl/thrd_equal.c: Likewise. * nptl/thrd_exit.c: Likewise. * nptl/thrd_join.c: Likewise. * nptl/thrd_priv.h: Likewise. * nptl/thrd_sleep.c: Likewise. * nptl/thrd_yield.c: Likewise. * include/threads.h: Likewise. |
||
---|---|---|
.. | ||
arpa | ||
net | ||
netinet | ||
sys | ||
aio.h-data | ||
assert.h-data | ||
complex.h-data | ||
cpio.h-data | ||
ctype.h-data | ||
dirent.h-data | ||
dlfcn.h-data | ||
errno.h-data | ||
fcntl.h-data | ||
fenv.h-data | ||
float.h-data | ||
fmtmsg.h-data | ||
fnmatch.h-data | ||
ftw.h-data | ||
glob.h-data | ||
grp.h-data | ||
iconv.h-data | ||
inttypes.h-data | ||
iso646.h-data | ||
langinfo.h-data | ||
libgen.h-data | ||
limits.h-data | ||
locale.h-data | ||
math.h-data | ||
monetary.h-data | ||
mqueue.h-data | ||
ndbm.h-data | ||
netdb.h-data | ||
nl_types.h-data | ||
poll.h-data | ||
pthread.h-data | ||
pwd.h-data | ||
regex.h-data | ||
sched.h-data | ||
search.h-data | ||
semaphore.h-data | ||
setjmp.h-data | ||
signal.h-data | ||
spawn.h-data | ||
stdalign.h-data | ||
stdarg.h-data | ||
stdbool.h-data | ||
stddef.h-data | ||
stdint.h-data | ||
stdio.h-data | ||
stdlib.h-data | ||
stdnoreturn.h-data | ||
string.h-data | ||
strings.h-data | ||
stropts.h-data | ||
syslog.h-data | ||
tar.h-data | ||
termios.h-data | ||
tgmath.h-data | ||
threads.h-data | ||
time.h-data | ||
uchar.h-data | ||
ucontext.h-data | ||
ulimit.h-data | ||
unistd.h-data | ||
utime.h-data | ||
utmpx.h-data | ||
varargs.h-data | ||
wchar.h-data | ||
wctype.h-data | ||
wordexp.h-data |