aboutsummaryrefslogtreecommitdiff
path: root/linuxthreads/restart.h
diff options
context:
space:
mode:
Diffstat (limited to 'linuxthreads/restart.h')
-rw-r--r--linuxthreads/restart.h35
1 files changed, 2 insertions, 33 deletions
diff --git a/linuxthreads/restart.h b/linuxthreads/restart.h
index 7492013..702d7d1 100644
--- a/linuxthreads/restart.h
+++ b/linuxthreads/restart.h
@@ -18,41 +18,10 @@
static inline void restart(pthread_descr th)
{
- kill(th->p_pid, __pthread_sig_restart);
+ __pthread_restart(th); /* see pthread.c */
}
static inline void suspend(pthread_descr self)
{
- sigset_t mask;
-
- sigprocmask(SIG_SETMASK, NULL, &mask); /* Get current signal mask */
- sigdelset(&mask, __pthread_sig_restart); /* Unblock the restart signal */
- do {
- self->p_signal = 0;
- sigsuspend(&mask); /* Wait for signal */
- } while (self->p_signal !=__pthread_sig_restart );
-}
-
-#define suspend_with_cancellation(self) \
-{ \
- sigset_t mask; \
- sigjmp_buf jmpbuf; \
- \
- sigprocmask(SIG_SETMASK, NULL, &mask); /* Get current signal mask */ \
- sigdelset(&mask, __pthread_sig_restart); /* Unblock the restart signal */ \
- /* No need to save the signal mask, we'll restore it ourselves */ \
- if (sigsetjmp(jmpbuf, 0) == 0) { \
- self->p_cancel_jmp = &jmpbuf; \
- if (! (self->p_canceled \
- && self->p_cancelstate == PTHREAD_CANCEL_ENABLE)) { \
- do { \
- self->p_signal = 0; \
- sigsuspend(&mask); /* Wait for a signal */ \
- } while (self->p_signal != __pthread_sig_restart); \
- } \
- self->p_cancel_jmp = NULL; \
- } else { \
- sigaddset(&mask, __pthread_sig_restart); /* Reblock the restart signal */ \
- sigprocmask(SIG_SETMASK, &mask, NULL); \
- } \
+ __pthread_suspend(self); /* see pthread.c */
}