aboutsummaryrefslogtreecommitdiff
path: root/linuxthreads/signals.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-08-26 16:00:46 +0000
committerUlrich Drepper <drepper@redhat.com>1998-08-26 16:00:46 +0000
commit00a2f9aa41a4f2a441c3b9787ca1a7701632de5f (patch)
tree55ba2c2f0f2e630c24fd23f81029c1dbc7de3058 /linuxthreads/signals.c
parent08cac4ac19abd40887afbd9d841cd96a8efbbe98 (diff)
downloadglibc-00a2f9aa41a4f2a441c3b9787ca1a7701632de5f.tar
glibc-00a2f9aa41a4f2a441c3b9787ca1a7701632de5f.tar.gz
glibc-00a2f9aa41a4f2a441c3b9787ca1a7701632de5f.tar.bz2
glibc-00a2f9aa41a4f2a441c3b9787ca1a7701632de5f.zip
Update.
1998-08-26 15:46 Ulrich Drepper <drepper@cygnus.com> * internals.h: Define THREAD_GETMEM and THREAD_SETMEM to default if not already defined. (struct _pthread_descr_struct): Add p_self and p_nr field. * manager.c (__pthread_handles): Define second element to point to manager thread. (__pthread_handles_num): Initialize to 2. (__pthread_manager): Use INIT_THREAD_SELF with two arguments. (pthread_start_thread): Likewise. (pthread_handle_create): Start search for free slot at entry 2. Initialize new fields p_self and p_nr. Call __clone with CLONE_PTRACE if available. (pthread_free): Call FREE_THREAD_SELF if available. * pthread.c (__pthread_initial_thread): Initialize new fields. (__pthread_manager_thread): Likewise. (__pthread_initialize_manager): Call __clone with CLONE_PTRACE. * cancel.c: Use THREAD_GETMEM and THREAD_SETMEM to access the elements of the thread descriptor. * condvar.c: Likewise. * errno.c: Likewise. * join.c: Likewise. * manager.c: Likewise. * pthread.c: Likewise. * ptlongjmp.c: Likewise. * semaphore.c: Likewise. * signals.c: Likewise. * specific.c: Likewise. * spinlock.c: Likewise. * sysdeps/alpha/pt-machine.h (INIT_THREAD_SELF): Add extra parameter. * sysdeps/i386/useldt.h: New file. * sysdeps/i386/i686/pt-machine.h: Show how to use this file. * sysdeps/sparc/sparc32/pt-machine.h: Define THREAD_GETMEM and THREAD_SETMEM using __thread_self. * sysdeps/sparc/sparc64/pt-machine.h: Likewise.
Diffstat (limited to 'linuxthreads/signals.c')
-rw-r--r--linuxthreads/signals.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/linuxthreads/signals.c b/linuxthreads/signals.c
index 392b5ea5a9..a6674bfc0d 100644
--- a/linuxthreads/signals.c
+++ b/linuxthreads/signals.c
@@ -76,17 +76,19 @@ static void pthread_sighandler(int signo)
char * in_sighandler;
/* If we're in a sigwait operation, just record the signal received
and return without calling the user's handler */
- if (self->p_sigwaiting) {
- self->p_sigwaiting = 0;
- self->p_signal = signo;
+ if (THREAD_GETMEM(self, p_sigwaiting)) {
+ THREAD_SETMEM(self, p_sigwaiting, 0);
+ THREAD_SETMEM(self, p_signal, signo);
return;
}
/* Record that we're in a signal handler and call the user's
handler function */
- in_sighandler = self->p_in_sighandler;
- if (in_sighandler == NULL) self->p_in_sighandler = CURRENT_STACK_FRAME;
+ in_sighandler = THREAD_GETMEM(self, p_in_sighandler);
+ if (in_sighandler == NULL)
+ THREAD_SETMEM(self, p_in_sighandler, CURRENT_STACK_FRAME);
sighandler[signo](signo);
- if (in_sighandler == NULL) self->p_in_sighandler = NULL;
+ if (in_sighandler == NULL)
+ THREAD_SETMEM(self, p_in_sighandler, NULL);
}
int sigaction(int sig, const struct sigaction * act,
@@ -131,21 +133,22 @@ int sigwait(const sigset_t * set, int * sig)
}
/* Test for cancellation */
if (sigsetjmp(jmpbuf, 1) == 0) {
- self->p_cancel_jmp = &jmpbuf;
- if (! (self->p_canceled && self->p_cancelstate == PTHREAD_CANCEL_ENABLE)) {
+ THREAD_SETMEM(self, p_cancel_jmp, &jmpbuf);
+ if (! (THREAD_GETMEM(self, p_canceled)
+ && THREAD_GETMEM(self, p_cancelstate) == PTHREAD_CANCEL_ENABLE)) {
/* Reset the signal count */
- self->p_signal = 0;
+ THREAD_SETMEM(self, p_signal, 0);
/* Say we're in sigwait */
- self->p_sigwaiting = 1;
+ THREAD_SETMEM(self, p_sigwaiting, 1);
/* Unblock the signals and wait for them */
sigsuspend(&mask);
}
}
- self->p_cancel_jmp = NULL;
+ THREAD_SETMEM(self, p_cancel_jmp, NULL);
/* The signals are now reblocked. Check for cancellation */
pthread_testcancel();
/* We should have self->p_signal != 0 and equal to the signal received */
- *sig = self->p_signal;
+ *sig = THREAD_GETMEM(self, p_signal);
return 0;
}