summaryrefslogtreecommitdiff
path: root/libguile/threads.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2016-11-05 11:33:20 +0100
committerAndy Wingo <wingo@pobox.com>2016-11-05 11:50:31 +0100
commit56dd476af7653b0c147c3416fd78e79f04ab44b1 (patch)
treebefd3275116005ca14752eabec0b0b3c4d257208 /libguile/threads.c
parent768246124164243059b0eeb772d3bb5bf1db0db9 (diff)
downloadguile-56dd476af7653b0c147c3416fd78e79f04ab44b1.tar.gz
Back to simple unlock-mutex
* libguile/threads.c (scm_unlock_mutex): Bind to unlock-mutex. * libguile/threads.h: Remove scm_unlock_mutex_timed. * libguile/deprecated.h: Add scm_unlock_mutex_timed. * libguile/deprecated.c (scm_unlock_mutex_timed): Deprecate. * test-suite/tests/threads.test: Update unlock-mutex tests to use wait-condition-variable if they would wait on a cond.
Diffstat (limited to 'libguile/threads.c')
-rw-r--r--libguile/threads.c35
1 files changed, 7 insertions, 28 deletions
diff --git a/libguile/threads.c b/libguile/threads.c
index d44d3b19e..5497eb057 100644
--- a/libguile/threads.c
+++ b/libguile/threads.c
@@ -1370,37 +1370,16 @@ fat_mutex_unlock (SCM mutex, SCM cond,
return ret;
}
-SCM scm_unlock_mutex (SCM mx)
+SCM_DEFINE (scm_unlock_mutex, "unlock-mutex", 1, 0, 0, (SCM mx),
+ "Unlocks @var{mutex}. The calling thread must already hold\n"
+ "the lock on @var{mutex}, unless the mutex was created with\n"
+ "the @code{allow-external-unlock} option; otherwise an error\n"
+ "will be signalled.")
+#define FUNC_NAME s_scm_unlock_mutex
{
- return scm_unlock_mutex_timed (mx, SCM_UNDEFINED, SCM_UNDEFINED);
-}
-
-SCM_DEFINE (scm_unlock_mutex_timed, "unlock-mutex", 1, 2, 0,
- (SCM mx, SCM cond, SCM timeout),
-"Unlocks @var{mutex} if the calling thread owns the lock on "
-"@var{mutex}. Calling unlock-mutex on a mutex not owned by the current "
-"thread results in undefined behaviour. Once a mutex has been unlocked, "
-"one thread blocked on @var{mutex} is awakened and grabs the mutex "
-"lock. Every call to @code{lock-mutex} by this thread must be matched "
-"with a call to @code{unlock-mutex}. Only the last call to "
-"@code{unlock-mutex} will actually unlock the mutex. ")
-#define FUNC_NAME s_scm_unlock_mutex_timed
-{
- scm_t_timespec cwaittime, *waittime = NULL;
-
SCM_VALIDATE_MUTEX (1, mx);
- if (! (SCM_UNBNDP (cond)))
- {
- SCM_VALIDATE_CONDVAR (2, cond);
-
- if (! SCM_UNBNDP (timeout) && ! scm_is_false (timeout))
- {
- to_timespec (timeout, &cwaittime);
- waittime = &cwaittime;
- }
- }
- return fat_mutex_unlock (mx, cond, waittime, 0) ? SCM_BOOL_T : SCM_BOOL_F;
+ return scm_from_bool (fat_mutex_unlock (mx, SCM_UNDEFINED, NULL, 0));
}
#undef FUNC_NAME