1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-30 22:43:12 +03:00
1999-10-26  Ulrich Drepper  <drepper@cygnus.com>

	* restart.h (suspend_with_cancellation): Rewrite as a macro.

	* condvar.c (pthread_cond_timedwait_relative): Don't mark as inline.
This commit is contained in:
Ulrich Drepper
1999-10-27 00:33:00 +00:00
parent 79b3c4ff79
commit 8dd1e49452
3 changed files with 29 additions and 22 deletions

View File

@ -1,3 +1,9 @@
1999-10-26 Ulrich Drepper <drepper@cygnus.com>
* restart.h (suspend_with_cancellation): Rewrite as a macro.
* condvar.c (pthread_cond_timedwait_relative): Don't mark as inline.
1999-10-25 Andreas Jaeger <aj@suse.de> 1999-10-25 Andreas Jaeger <aj@suse.de>
* internals.h: Remove K&R compatibility. * internals.h: Remove K&R compatibility.

View File

@ -61,7 +61,7 @@ int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
return 0; return 0;
} }
static inline int static int
pthread_cond_timedwait_relative(pthread_cond_t *cond, pthread_cond_timedwait_relative(pthread_cond_t *cond,
pthread_mutex_t *mutex, pthread_mutex_t *mutex,
const struct timespec * reltime) const struct timespec * reltime)

View File

@ -33,25 +33,26 @@ static inline void suspend(pthread_descr self)
} while (self->p_signal !=__pthread_sig_restart ); } while (self->p_signal !=__pthread_sig_restart );
} }
static inline void suspend_with_cancellation(pthread_descr self) #define suspend_with_cancellation(self) \
{ { \
sigset_t mask; sigset_t mask; \
sigjmp_buf jmpbuf; sigjmp_buf jmpbuf; \
\
sigprocmask(SIG_SETMASK, NULL, &mask); /* Get current signal mask */ sigprocmask(SIG_SETMASK, NULL, &mask); /* Get current signal mask */ \
sigdelset(&mask, __pthread_sig_restart); /* Unblock the restart signal */ sigdelset(&mask, __pthread_sig_restart); /* Unblock the restart signal */ \
/* No need to save the signal mask, we'll restore it ourselves */ /* No need to save the signal mask, we'll restore it ourselves */ \
if (sigsetjmp(jmpbuf, 0) == 0) { if (sigsetjmp(jmpbuf, 0) == 0) { \
self->p_cancel_jmp = &jmpbuf; self->p_cancel_jmp = &jmpbuf; \
if (! (self->p_canceled && self->p_cancelstate == PTHREAD_CANCEL_ENABLE)) { if (! (self->p_canceled \
do { && self->p_cancelstate == PTHREAD_CANCEL_ENABLE)) { \
self->p_signal = 0; do { \
sigsuspend(&mask); /* Wait for a signal */ self->p_signal = 0; \
} while (self->p_signal != __pthread_sig_restart); sigsuspend(&mask); /* Wait for a signal */ \
} } while (self->p_signal != __pthread_sig_restart); \
self->p_cancel_jmp = NULL; } \
} else { self->p_cancel_jmp = NULL; \
sigaddset(&mask, __pthread_sig_restart); /* Reblock the restart signal */ } else { \
sigprocmask(SIG_SETMASK, &mask, NULL); sigaddset(&mask, __pthread_sig_restart); /* Reblock the restart signal */ \
} sigprocmask(SIG_SETMASK, &mask, NULL); \
} \
} }