guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] GNU Guile branch, master, updated. v2.1.0-17-g1701a68


From: Ludovic Courtès
Subject: [Guile-commits] GNU Guile branch, master, updated. v2.1.0-17-g1701a68
Date: Thu, 30 May 2013 21:30:59 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=1701a68920cf1b83d320711a4d47806ba089c148

The branch, master has been updated
       via  1701a68920cf1b83d320711a4d47806ba089c148 (commit)
      from  b782ed0137e93f3bcfcffdbfe2785e6425ef9e32 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 1701a68920cf1b83d320711a4d47806ba089c148
Author: Ludovic Courtès <address@hidden>
Date:   Thu May 30 23:30:27 2013 +0200

    Do not assume `pthread_t' is an integer type.
    
    Fixes <http://bugs.gnu.org/14469>.
    Reported by Panicz Maciej Godek <address@hidden>.
    
    * libguile/finalizers.c (finalization_thread_is_running): New variable.
      (start_finalization_thread): Use it to determine whether
      FINALIZATION_THREAD is up and running.
      (stop_finalization_thread): Likewise.

-----------------------------------------------------------------------

Summary of changes:
 libguile/finalizers.c |   25 +++++++++++++++----------
 1 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/libguile/finalizers.c b/libguile/finalizers.c
index 7fadd22..db4e4c4 100644
--- a/libguile/finalizers.c
+++ b/libguile/finalizers.c
@@ -185,6 +185,7 @@ static int finalization_pipe[2];
 static scm_i_pthread_mutex_t finalization_thread_lock =
   SCM_I_PTHREAD_MUTEX_INITIALIZER;
 static pthread_t finalization_thread;
+static int finalization_thread_is_running = 0;
 
 static void
 notify_finalizers_to_run (void)
@@ -256,14 +257,18 @@ static void
 start_finalization_thread (void)
 {
   scm_i_pthread_mutex_lock (&finalization_thread_lock);
-  if (!finalization_thread)
-    /* Use the raw pthread API and scm_with_guile, because we don't want
-       to block on any lock that scm_spawn_thread might want to take,
-       and we don't want to inherit the dynamic state (fluids) of the
-       caller.  */
-    if (pthread_create (&finalization_thread, NULL,
-                        run_finalization_thread, NULL))
-      perror ("error creating finalization thread");
+  if (!finalization_thread_is_running)
+    {
+      /* Use the raw pthread API and scm_with_guile, because we don't want
+        to block on any lock that scm_spawn_thread might want to take,
+        and we don't want to inherit the dynamic state (fluids) of the
+        caller.  */
+      if (pthread_create (&finalization_thread, NULL,
+                         run_finalization_thread, NULL))
+       perror ("error creating finalization thread");
+      else
+       finalization_thread_is_running = 1;
+    }
   scm_i_pthread_mutex_unlock (&finalization_thread_lock);
 }
 
@@ -271,12 +276,12 @@ static void
 stop_finalization_thread (void)
 {
   scm_i_pthread_mutex_lock (&finalization_thread_lock);
-  if (finalization_thread)
+  if (finalization_thread_is_running)
     {
       notify_about_to_fork ();
       if (pthread_join (finalization_thread, NULL))
         perror ("joining finalization thread");
-      finalization_thread = 0;
+      finalization_thread_is_running = 0;
     }
   scm_i_pthread_mutex_unlock (&finalization_thread_lock);
 }


hooks/post-receive
-- 
GNU Guile



reply via email to

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