[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))
- [Guile-commits] branch master updated (fcc6a7b -> f8de980), Andy Wingo, 2016/11/06
- [Guile-commits] 04/24: Remove export srfi-18 never had, Andy Wingo, 2016/11/06
- [Guile-commits] 01/24: Fix typo in threads documentation, Andy Wingo, 2016/11/06
- [Guile-commits] 02/24: try-mutex in terms of mutex-lock, Andy Wingo, 2016/11/06
- [Guile-commits] 12/24: Remove fat mutex abandoned mutex error, Andy Wingo, 2016/11/06
- [Guile-commits] 09/24: SRFI-18 manages own mutex "abandoned" state, Andy Wingo, 2016/11/06
- [Guile-commits] 05/24: srfi-18 condition variables disjoint, Andy Wingo, 2016/11/06
- [Guile-commits] 10/24: Remove thread-local weak mutex set, Andy Wingo, 2016/11/06
- [Guile-commits] 18/24: Back to simple unlock-mutex, Andy Wingo, 2016/11/06
- [Guile-commits] 08/24: Remove lock-mutex owner facility,
Andy Wingo <=
- [Guile-commits] 14/24: SRFI-18 mutexes are not recursive, Andy Wingo, 2016/11/06
- [Guile-commits] 07/24: SRFI-18 threads disjoint from guile threads, Andy Wingo, 2016/11/06
- [Guile-commits] 21/24: scm_timed_lock_mutex replaces scm_lock_mutex_timed, Andy Wingo, 2016/11/06
- [Guile-commits] 15/24: Recursively locking a SRFI-18 mutex blocks, Andy Wingo, 2016/11/06
- [Guile-commits] 19/24: Separate fat mutex unlock and wait operations, Andy Wingo, 2016/11/06
- [Guile-commits] 06/24: Update SRFI-18 documentation., Andy Wingo, 2016/11/06
- [Guile-commits] 11/24: Remove thread held pthread_mutex field, Andy Wingo, 2016/11/06
- [Guile-commits] 13/24: Move more functionality to SRFI-18 mutex-unlock!, Andy Wingo, 2016/11/06
- [Guile-commits] 03/24: SRFI-18 mutexes disjoint from Guile mutexes, Andy Wingo, 2016/11/06
- [Guile-commits] 16/24: Remove unchecked-unlock facility from Guile mutexes, Andy Wingo, 2016/11/06