[PATCH 2/4] Add C11 threads support
Szabolcs Nagy
szabolcs.nagy@arm.com
Fri Jun 23 09:57:00 GMT 2017
On 19/06/17 19:52, Adhemerval Zanella wrote:
> For mostly symbol implementations, direct POSIX pthread internal calls
> are used with some 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.
>
note that hacks that interpose pthread symbols
to catch thread creation will no longer work if
thrd_create gets used.
> 2. thrd_sleep uses nanosleep internal direct syscall to avoid clobbering
> errno and to handle expected standard return codes.
>
note that it also avoids a cancellation point.
i think that's the right thing to do.
More information about the Libc-alpha
mailing list