This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/4] Add C11 threads support


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]