add C11 thread creation and related thread functions
authorRich Felker <dalias@aerifal.cx>
Sun, 7 Sep 2014 14:28:08 +0000 (10:28 -0400)
committerRich Felker <dalias@aerifal.cx>
Sun, 7 Sep 2014 14:28:08 +0000 (10:28 -0400)
commit23614b0fcb4cd4d7b2e4148d3b1887b642169765
treeffee3db90209dedcc61b1afdd255be2af2d39b8a
parent14397cec2c8429b504b17aaf92509b48da3681b9
add C11 thread creation and related thread functions

based on patch by Jens Gustedt.

the main difficulty here is handling the difference between start
function signatures and thread return types for C11 threads versus
POSIX threads. pointers to void are assumed to be able to represent
faithfully all values of int. the function pointer for the thread
start function is cast to an incorrect type for passing through
pthread_create, but is cast back to its correct type before calling so
that the behavior of the call is well-defined.

changes to the existing threads implementation were kept minimal to
reduce the risk of regressions, and duplication of code that carries
implementation-specific assumptions was avoided for ease and safety of
future maintenance.
src/internal/pthread_impl.h
src/thread/pthread_create.c
src/thread/pthread_detach.c
src/thread/pthread_equal.c
src/thread/pthread_self.c
src/thread/thrd_create.c [new file with mode: 0644]
src/thread/thrd_exit.c [new file with mode: 0644]
src/thread/thrd_join.c [new file with mode: 0644]
src/thread/thrd_sleep.c [new file with mode: 0644]
src/thread/thrd_yield.c [new file with mode: 0644]