This is the mail archive of the
mailing list for the glibc project.
Re: [PATCH 2/4] Add C11 threads support
- From: Szabolcs Nagy <szabolcs dot nagy at arm dot com>
- To: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>, libc-alpha at sourceware dot org
- Cc: nd at arm dot com
- Date: Fri, 23 Jun 2017 10:57:14 +0100
- Subject: Re: [PATCH 2/4] Add C11 threads support
- Authentication-results: sourceware.org; auth=none
- Authentication-results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com;
- Nodisclaimer: True
- References: <firstname.lastname@example.org> <email@example.com>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
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.