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.
Showing
src/thread/thrd_create.c
0 → 100644
src/thread/thrd_exit.c
0 → 100644
src/thread/thrd_join.c
0 → 100644
src/thread/thrd_sleep.c
0 → 100644
src/thread/thrd_yield.c
0 → 100644
想要评论请 注册 或 登录