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-66-gf9c3584


From: Andy Wingo
Subject: [Guile-commits] GNU Guile branch, master, updated. v2.1.0-66-gf9c3584
Date: Fri, 24 Feb 2012 18:44:49 +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=f9c3584117d32680af91a5b2a10e262e8176bd61

The branch, master has been updated
       via  f9c3584117d32680af91a5b2a10e262e8176bd61 (commit)
       via  fea65eb231c15190dfecad4966fc026a3d57289a (commit)
      from  eaf99988aecdcacd9204f61ba1d307584300f751 (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 f9c3584117d32680af91a5b2a10e262e8176bd61
Author: Andy Wingo <address@hidden>
Date:   Fri Feb 24 19:42:00 2012 +0100

    srfi-18 cleanup
    
    * module/srfi/srfi-18.scm (with-exception-handler):
      (thread-join!, mutex-lock!, mutex-unlock!): Avoid useless invocations
      of `apply'.

commit fea65eb231c15190dfecad4966fc026a3d57289a
Author: Andy Wingo <address@hidden>
Date:   Fri Feb 24 18:57:37 2012 +0100

    statically initialize the pthread mutex in fat mutexen
    
    * libguile/threads.c (make_fat_mutex): Remove smob free function.
      Because we use normal mutexen, we can just blit the mutex to
      initialize it.

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

Summary of changes:
 libguile/threads.c      |   14 ++++----------
 module/srfi/srfi-18.scm |   26 +++++++++++++-------------
 2 files changed, 17 insertions(+), 23 deletions(-)

diff --git a/libguile/threads.c b/libguile/threads.c
index d5c51ea..3135570 100644
--- a/libguile/threads.c
+++ b/libguile/threads.c
@@ -1291,14 +1291,6 @@ SCM_DEFINE (scm_thread_p, "thread?", 1, 0, 0,
 #undef FUNC_NAME
 
 
-static size_t
-fat_mutex_free (SCM mx)
-{
-  fat_mutex *m = SCM_MUTEX_DATA (mx);
-  scm_i_pthread_mutex_destroy (&m->lock);
-  return 0;
-}
-
 static int
 fat_mutex_print (SCM mx, SCM port, scm_print_state *pstate SCM_UNUSED)
 {
@@ -1314,9 +1306,12 @@ make_fat_mutex (int recursive, int unchecked_unlock, int 
external_unlock)
 {
   fat_mutex *m;
   SCM mx;
+  scm_i_pthread_mutex_t lock = SCM_I_PTHREAD_MUTEX_INITIALIZER;
 
   m = scm_gc_malloc (sizeof (fat_mutex), "mutex");
-  scm_i_pthread_mutex_init (&m->lock, NULL);
+  /* Because PTHREAD_MUTEX_INITIALIZER is static, it's plain old data,
+     and so we can just copy it.  */
+  memcpy (&m->lock, &lock, sizeof (m->lock));
   m->owner = SCM_BOOL_F;
   m->level = 0;
 
@@ -2183,7 +2178,6 @@ scm_init_threads ()
 
   scm_tc16_mutex = scm_make_smob_type ("mutex", sizeof (fat_mutex));
   scm_set_smob_print (scm_tc16_mutex, fat_mutex_print);
-  scm_set_smob_free (scm_tc16_mutex, fat_mutex_free);
 
   scm_tc16_condvar = scm_make_smob_type ("condition-variable",
                                         sizeof (fat_cond));
diff --git a/module/srfi/srfi-18.scm b/module/srfi/srfi-18.scm
index 4921a95..684a125 100644
--- a/module/srfi/srfi-18.scm
+++ b/module/srfi/srfi-18.scm
@@ -1,6 +1,6 @@
 ;;; srfi-18.scm --- Multithreading support
 
-;; Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 2008, 2009, 2010, 2012 Free Software Foundation, Inc.
 ;;
 ;; This library is free software; you can redistribute it and/or
 ;; modify it under the terms of the GNU Lesser General Public
@@ -145,15 +145,15 @@
     (check-arg-type procedure? handler "with-exception-handler") 
     (check-arg-type thunk? thunk "with-exception-handler")
     (hashq-set! thread-exception-handlers ct (cons handler hl))
-    (apply (@ (srfi srfi-34) with-exception-handler) 
-           (list (lambda (obj)
-                   (hashq-set! thread-exception-handlers ct hl) 
-                   (handler obj))
-                 (lambda () 
-                   (call-with-values thunk
-                     (lambda res
-                       (hashq-set! thread-exception-handlers ct hl)
-                       (apply values res))))))))
+    ((@ (srfi srfi-34) with-exception-handler) 
+     (lambda (obj)
+       (hashq-set! thread-exception-handlers ct hl) 
+       (handler obj))
+     (lambda () 
+       (call-with-values thunk
+         (lambda res
+           (hashq-set! thread-exception-handlers ct hl)
+           (apply values res)))))))
 
 (define (current-exception-handler)
   (car (current-handler-stack)))
@@ -277,7 +277,7 @@
 (define (thread-join! thread . args) 
   (define thread-join-inner!
     (wrap (lambda ()
-           (let ((v (apply join-thread (cons thread args)))
+           (let ((v (apply join-thread thread args))
                  (e (thread->exception thread)))
              (if (and (= (length args) 1) (not v))
                  (raise join-timeout-exception))
@@ -320,12 +320,12 @@
   (define mutex-lock-inner!
     (wrap (lambda ()
            (catch 'abandoned-mutex-error
-                  (lambda () (apply lock-mutex (cons mutex args)))
+                  (lambda () (apply lock-mutex mutex args))
                   (lambda (key . args) (raise abandoned-mutex-exception))))))
   (call/cc mutex-lock-inner!))
 
 (define (mutex-unlock! mutex . args) 
-  (apply unlock-mutex (cons mutex args)))
+  (apply unlock-mutex mutex args))
 
 ;; CONDITION VARIABLES
 ;; These functions are all pass-thrus to the existing Guile implementations.


hooks/post-receive
-- 
GNU Guile



reply via email to

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