guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] 14/17: Remove last critical section use


From: Andy Wingo
Subject: [Guile-commits] 14/17: Remove last critical section use
Date: Tue, 1 Nov 2016 22:50:44 +0000 (UTC)

wingo pushed a commit to branch master
in repository guile.

commit 65268ff37a89e02eddb5658c5c0e97ed9d0fe3c4
Author: Andy Wingo <address@hidden>
Date:   Tue Nov 1 23:31:11 2016 +0100

    Remove last critical section use
    
    * libguile/scmsigs.c (signal_handler_lock): New variable.
      (scm_sigaction_for_thread): Block asyncs and use a mutex instead of
      using scm_dynwind_critical_section.
---
 libguile/scmsigs.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libguile/scmsigs.c b/libguile/scmsigs.c
index d52fe8c..d852e71 100644
--- a/libguile/scmsigs.c
+++ b/libguile/scmsigs.c
@@ -86,6 +86,8 @@
    signal_handler_threads points to the thread that a signal should be
    delivered to.
 */
+static scm_i_pthread_mutex_t signal_handler_lock =
+  SCM_I_PTHREAD_MUTEX_INITIALIZER;
 static SCM *signal_handlers;
 static SCM signal_handler_asyncs;
 static SCM signal_handler_threads;
@@ -335,7 +337,8 @@ SCM_DEFINE (scm_sigaction_for_thread, "sigaction", 1, 3, 0,
   scm_i_ensure_signal_delivery_thread ();
 
   scm_dynwind_begin (0);
-  scm_dynwind_critical_section (SCM_BOOL_F);
+  scm_dynwind_pthread_mutex_lock (&signal_handler_lock);
+  scm_dynwind_block_asyncs ();
 
   old_handler = SCM_SIMPLE_VECTOR_REF (*signal_handlers, csig);
   if (SCM_UNBNDP (handler))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]