This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
pthread_sigqueue{_np} ??
- To: libc-alpha at sourceware dot cygnus dot com
- Subject: pthread_sigqueue{_np} ??
- From: Bharadwaj Yadavalli <sby at ives dot lkg dot dec dot com>
- Date: Thu, 8 Feb 2001 12:35:36 -0500 (EST)
- Reply-To: Bharadwaj Yadavalli <bharadwaj dot yadavalli at compaq dot com>
Thanks Andreas Jaeger for pointing me to the right
implementation of sigqueue.
Now that I know (and verified) that sigqueue() is
implemented in glibc I am wondering if it makes sense
to implement pthread_sigqueue() (or pthread_sigqueue_np
since pthread_sigqueue() is not a defined interface
in POSIX). By this interface we would get all the
advantages of using sigqueue on a thread. (I do realize
on Linux, a thread is a clone()'d process and all).
Consequent to a brief look at the code for pthread_kill()
in linuxthreads/signals.c the following adaptation would
do the job.
int pthread_sigqueue_np(pthread_t thread,
int signo,
const union sigval val)
{
pthread_handle handle = thread_handle(thread);
int pid;
__pthread_lock(&handle->h_lock, NULL);
if (invalid_handle(handle, thread)) {
__pthread_unlock(&handle->h_lock);
return ESRCH;
}
pid = handle->h_descr->p_pid;
__pthread_unlock(&handle->h_lock);
if (sigqueue(pid, signo, val) == -1)
return errno;
else
return 0;
}
Comments?
Bharadwaj