summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2016-11-04 23:32:26 +0100
committerAndy Wingo <wingo@pobox.com>2016-11-04 23:32:26 +0100
commitecfa0b50cec560ecd960d602d99b7443b07dffc2 (patch)
treec6ac72f982bc0aa28b9e65a0baa490773707beb9
parent3ce76c38cb3d041970c483635429743318938aa5 (diff)
downloadguile-ecfa0b50cec560ecd960d602d99b7443b07dffc2.tar.gz
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.
-rw-r--r--libguile/threads.c13
-rw-r--r--test-suite/tests/threads.test13
2 files changed, 9 insertions, 17 deletions
diff --git a/libguile/threads.c b/libguile/threads.c
index 022534808..79d0f8134 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 f489d5958..ee6a505f9 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))