]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
(suspend_with_cancellation): Rewrite as a macro.
authorUlrich Drepper <drepper@redhat.com>
Wed, 10 Nov 1999 05:01:52 +0000 (05:01 +0000)
committerUlrich Drepper <drepper@redhat.com>
Wed, 10 Nov 1999 05:01:52 +0000 (05:01 +0000)
linuxthreads/restart.h

index 54a6f503219d690b4e39b5d1c4ede606b2e45918..749201391d6d70485230a9cdeaa704c1952da4c5 100644 (file)
@@ -33,25 +33,26 @@ static inline void suspend(pthread_descr self)
   } while (self->p_signal !=__pthread_sig_restart );
 }
 
-static inline void suspend_with_cancellation(pthread_descr 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);
-  }
+#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);                                   \
+  }                                                                          \
 }