guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] 08/24: Remove lock-mutex owner facility


From: Andy Wingo
Subject: [Guile-commits] 08/24: Remove lock-mutex owner facility
Date: Sun, 6 Nov 2016 18:00:45 +0000 (UTC)

wingo pushed a commit to branch master
in repository guile.

commit ecfa0b50cec560ecd960d602d99b7443b07dffc2
Author: Andy Wingo <address@hidden>
Date:   Fri Nov 4 23:32:26 2016 +0100

    Remove lock-mutex owner facility
    
    * libguile/threads.c (scm_lock_mutex_timed): Deprecate "owner"
      argument.
      (fat_mutex_lock): Remove owner argument.
      (fat_mutex_unlock): Don't pass owner to scm_lock_mutex_timed.
    * test-suite/tests/threads.test: Remove tests of mutex-owner.
---
 libguile/threads.c            |   13 ++++++++-----
 test-suite/tests/threads.test |   13 +------------
 2 files changed, 9 insertions(+), 17 deletions(-)

diff --git a/libguile/threads.c b/libguile/threads.c
index 0225348..79d0f81 100644
--- a/libguile/threads.c
+++ b/libguile/threads.c
@@ -27,6 +27,7 @@
 #include "libguile/bdw-gc.h"
 #include <gc/gc_mark.h>
 #include "libguile/_scm.h"
+#include "libguile/deprecation.h"
 
 #include <stdlib.h>
 #include <unistd.h>
@@ -1165,11 +1166,11 @@ SCM_DEFINE (scm_make_recursive_mutex, 
"make-recursive-mutex", 0, 0, 0,
 SCM_SYMBOL (scm_abandoned_mutex_error_key, "abandoned-mutex-error");
 
 static SCM
-fat_mutex_lock (SCM mutex, scm_t_timespec *timeout, SCM owner, int *ret)
+fat_mutex_lock (SCM mutex, scm_t_timespec *timeout, int *ret)
 {
   fat_mutex *m = SCM_MUTEX_DATA (mutex);
 
-  SCM new_owner = SCM_UNBNDP (owner) ? scm_current_thread() : owner;
+  SCM new_owner = scm_current_thread();
   SCM err = SCM_BOOL_F;
 
   struct timeval current_time;
@@ -1281,9 +1282,11 @@ SCM_DEFINE (scm_lock_mutex_timed, "lock-mutex", 1, 2, 0,
     }
 
   if (!SCM_UNBNDP (owner) && !scm_is_false (owner))
-    SCM_VALIDATE_THREAD (3, owner);
+    scm_c_issue_deprecation_warning
+      ("The 'owner' argument to lock-mutex is deprecated.  Use SRFI-18 "
+       "directly if you need this concept.");
 
-  exception = fat_mutex_lock (m, waittime, owner, &ret);
+  exception = fat_mutex_lock (m, waittime, &ret);
   if (!scm_is_false (exception))
     scm_ithrow (SCM_CAR (exception), scm_list_1 (SCM_CDR (exception)), 1);
   return ret ? SCM_BOOL_T : SCM_BOOL_F;
@@ -1418,7 +1421,7 @@ fat_mutex_unlock (SCM mutex, SCM cond,
          if (brk)
            {
              if (relock)
-               scm_lock_mutex_timed (mutex, SCM_UNDEFINED, owner);
+               scm_lock_mutex_timed (mutex, SCM_UNDEFINED, SCM_UNDEFINED);
              t->block_asyncs--;
              break;
            }
diff --git a/test-suite/tests/threads.test b/test-suite/tests/threads.test
index f489d59..ee6a505 100644
--- a/test-suite/tests/threads.test
+++ b/test-suite/tests/threads.test
@@ -382,18 +382,7 @@
          (let ((m (make-mutex)))
            (not (mutex-owner m))))
 
-       (pass-if "locking mutex on behalf of other thread"
-         (let* ((m (make-mutex))
-                (t (begin-thread 'foo)))
-           (lock-mutex m #f t)
-           (eq? (mutex-owner m) t)))
-
-        (pass-if "locking mutex with no owner"
-         (let ((m (make-mutex)))
-           (lock-mutex m #f #f)
-           (not (mutex-owner m))))
-
-        (pass-if "mutex with owner not retained (bug #27450)"
+       (pass-if "mutex with owner not retained (bug #27450)"
           (let ((g (make-guardian)))
             (g (let ((m (make-mutex))) (lock-mutex m) m))
 



reply via email to

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