Skip to content

Commit

Permalink
Cygwin: Change pthread_sigqueue() to accept thread id
Browse files Browse the repository at this point in the history
Change the first parameter of pthread_sigqueue() to be a thread id rather
than a thread pointer. The change is to match the Linux implementation of
this function.

The user-visible function prototype is changed in include/pthread.h.
The pthread_sigqueue() function is modified to work with a passed-in thread
id rather than an indirect thread pointer as before.  (It used to be
"pthread_t *thread", i.e., class pthread **.)  The release note for Cygwin
3.5.5 is updated.

Reported-by: Christian Franke <[email protected]>
Addresses: https://cygwin.com/pipermail/cygwin/2024-September/256439.html
Signed-off-by: Mark Geisert <[email protected]>
Fixes: 50350ca ("* cygwin.din (pthread_sigqueue): Export.")
(cherry picked from commit 1e8c92e)
  • Loading branch information
mgeisert authored and github-cygwin committed Nov 12, 2024
1 parent 9dad29c commit b9060e0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion winsup/cygwin/include/pthread.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ int pthread_getattr_np (pthread_t, pthread_attr_t *);
int pthread_getname_np (pthread_t, char *, size_t) __attribute__((__nonnull__(2)));
int pthread_setaffinity_np (pthread_t, size_t, const cpu_set_t *);
int pthread_setname_np (pthread_t, const char *) __attribute__((__nonnull__(2)));
int pthread_sigqueue (pthread_t *, int, const union sigval);
int pthread_sigqueue (pthread_t, int, const union sigval);
int pthread_timedjoin_np (pthread_t, void **, const struct timespec *);
int pthread_tryjoin_np (pthread_t, void **);
#endif
Expand Down
3 changes: 3 additions & 0 deletions winsup/cygwin/release/3.5.5
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ Fixes:

- Fix a problem that signal handler destroys the FPU context.
Addresses: https://cygwin.com/pipermail/cygwin/2024-October/256503.html

- Fix type of pthread_sigqueue() first parameter to match Linux.
Addresses: https://cygwin.com/pipermail/cygwin/2024-September/256439.html
8 changes: 4 additions & 4 deletions winsup/cygwin/thread.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3301,21 +3301,21 @@ pthread_sigmask (int operation, const sigset_t *set, sigset_t *old_set)
}

int
pthread_sigqueue (pthread_t *thread, int sig, const union sigval value)
pthread_sigqueue (pthread_t thread, int sig, const union sigval value)
{
siginfo_t si = {0};

if (!pthread::is_good_object (thread))
if (!pthread::is_good_object (&thread))
return EINVAL;
if (!(*thread)->valid)
if (!thread->valid)
return ESRCH;

si.si_signo = sig;
si.si_code = SI_QUEUE;
si.si_value = value;
si.si_pid = myself->pid;
si.si_uid = myself->uid;
return (int) sig_send (NULL, si, (*thread)->cygtls);
return (int) sig_send (NULL, si, thread->cygtls);
}

/* Cancelability */
Expand Down

0 comments on commit b9060e0

Please sign in to comment.