[Bug 278459] Add pthread_sigqueue()

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 19 Apr 2024 13:07:21 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=278459

            Bug ID: 278459
           Summary: Add pthread_sigqueue()
           Product: Base System
           Version: 14.0-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: vini.ipsmaker@gmail.com

Linux and Solaris 11 offer pthread_sigqueue(3) that is to sigqueue(2) what
pthread_kill(3) is to kill(2). I've been using pthread_sigqueue() on my own
software to offer different "cancellation paths". To illustrate my need, here
is the piece of the code that I want to be cancellable:

https://gitlab.com/emilua/emilua/-/blob/v0.7.1/src/file.cpp#L520-532

As you can see, I use setjmp() for a switch expression that will allow me to
jump to different cancel-handling paths.

Here's the cancellation type-1:
https://gitlab.com/emilua/emilua/-/blob/v0.7.1/src/file.cpp#L463

Here's cancellation type-2:
https://gitlab.com/emilua/emilua/-/blob/v0.7.1/src/file.cpp#L93

Both cancellators just use pthread_sigqueue(). Cancellator type-1 will use
sigval::sival_int=1 and cancellator type-2 will use sigval::sival_int=2. The
sighandler (SA_SIGINFO) will use this value as an argument to longjmp():
https://gitlab.com/emilua/emilua/-/blob/v0.7.1/src/core.cpp#L756

Can FreeBSD have pthread_sigqueue() as in Linux and Solaris?

-- 
You are receiving this mail because:
You are the assignee for the bug.