public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "sstewartgallus00 at mylangara dot bc.ca" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug libc/17168] Can GLibc expose futex now?
Date: Sat, 19 Jul 2014 01:10:00 -0000	[thread overview]
Message-ID: <bug-17168-131-rlgci1krsH@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-17168-131@http.sourceware.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.


  parent reply	other threads:[~2014-07-19  1:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-17  4:44 [Bug libc/17168] New: " sstewartgallus00 at mylangara dot bc.ca
2014-07-17  4:57 ` [Bug libc/17168] " sstewartgallus00 at mylangara dot bc.ca
2014-07-19  1:10 ` sstewartgallus00 at mylangara dot bc.ca [this message]
2014-07-19 18:34 ` sstewartgallus00 at mylangara dot bc.ca
2014-07-19 18:55 ` bugdal at aerifal dot cx

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-17168-131-rlgci1krsH@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).