This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/17168] Can GLibc expose futex now?
- From: "sstewartgallus00 at mylangara dot bc.ca" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Sat, 19 Jul 2014 01:10:03 +0000
- Subject: [Bug libc/17168] Can GLibc expose futex now?
- Auto-submitted: auto-generated
- References: <bug-17168-131 at http dot sourceware dot org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=17168
--- Comment #2 from Steven Stewart-Gallus <sstewartgallus00 at mylangara dot bc.ca> ---
I'm confused, in the source in nptl/nptl-init.c the signal handler is
not set with the flag for the SA_RESTART and so I should be able to
simply handle pthread_cancel by waiting for EINTR and then using
pthread_testcancel? However, pthread_cancel only seems to send the
signal when asynchronous cancels are enabled and not for deferred
cancels?
The source:
struct sigaction sa;
sa.sa_sigaction = sigcancel_handler;
sa.sa_flags = SA_SIGINFO;
__sigemptyset (&sa.sa_mask);
(void) __libc_sigaction (SIGCANCEL, &sa, NULL);
The possible workaround:
static errno_t futex_wait(int *uaddr, int val, struct timespec const *timeout)
{
int xx = syscall(__NR_futex, (intptr_t)uaddr, (intptr_t)FUTEX_WAIT,
(intptr_t)val,
(intptr_t)timeout);
if (xx < 0) {
errno_t errnum = errno;
if (EINTR == errnum) {
pthread_testcancel();
}
return errnum;
}
return 0;
}
--
You are receiving this mail because:
You are on the CC list for the bug.