[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 21/24: scm_timed_lock_mutex replaces scm_lock_mutex_time
From: |
Andy Wingo |
Subject: |
[Guile-commits] 21/24: scm_timed_lock_mutex replaces scm_lock_mutex_timed |
Date: |
Sun, 6 Nov 2016 18:00:46 +0000 (UTC) |
wingo pushed a commit to branch master
in repository guile.
commit 03ffd726df81731a0b1738bf2bb4842ea730c680
Author: Andy Wingo <address@hidden>
Date: Sat Nov 5 19:39:12 2016 +0100
scm_timed_lock_mutex replaces scm_lock_mutex_timed
* libguile/deprecated.h:
* libguile/deprecated.c (scm_lock_mutex_timed): Deprecate.
* libguile/threads.h:
* libguile/threads.c (scm_timed_lock_mutex): New function.
(scm_join_thread): Fix formatting.
(scm_lock_mutex): Fix formatting and update to scm_timed_lock_mutex
change.
(scm_try_mutex): Update to scm_timed_lock_mutex.
---
libguile/deprecated.c | 15 +++++++++++++++
libguile/deprecated.h | 1 +
libguile/threads.c | 27 ++++++++++-----------------
libguile/threads.h | 2 +-
4 files changed, 27 insertions(+), 18 deletions(-)
diff --git a/libguile/deprecated.c b/libguile/deprecated.c
index d2e01f3..6da604e 100644
--- a/libguile/deprecated.c
+++ b/libguile/deprecated.c
@@ -700,6 +700,21 @@ scm_make_mutex_with_flags (SCM flags)
}
SCM
+scm_lock_mutex_timed (SCM m, SCM timeout, SCM owner)
+{
+ scm_c_issue_deprecation_warning
+ ("'scm_lock_mutex_timed' is deprecated. "
+ "Use 'scm_timed_lock_mutex' instead.");
+
+ if (!SCM_UNBNDP (owner) && !scm_is_false (owner))
+ scm_c_issue_deprecation_warning
+ ("The 'owner' argument to 'scm_lock_mutex_timed' is deprecated. "
+ "Use SRFI-18 directly if you need this concept.");
+
+ return scm_timed_lock_mutex (m, timeout);
+}
+
+SCM
scm_unlock_mutex_timed (SCM mx, SCM cond, SCM timeout)
{
scm_c_issue_deprecation_warning
diff --git a/libguile/deprecated.h b/libguile/deprecated.h
index 5948fc5..211266f 100644
--- a/libguile/deprecated.h
+++ b/libguile/deprecated.h
@@ -240,6 +240,7 @@ SCM_DEPRECATED void scm_dynwind_critical_section (SCM
mutex);
SCM_DEPRECATED SCM scm_make_mutex_with_flags (SCM flags);
SCM_DEPRECATED SCM scm_unlock_mutex_timed (SCM mx, SCM cond, SCM timeout);
+SCM_DEPRECATED SCM scm_lock_mutex_timed (SCM m, SCM timeout, SCM owner);
diff --git a/libguile/threads.c b/libguile/threads.c
index d7295bc..0da9de1 100644
--- a/libguile/threads.c
+++ b/libguile/threads.c
@@ -987,7 +987,8 @@ scm_cancel_thread (SCM thread)
return SCM_UNSPECIFIED;
}
-SCM scm_join_thread (SCM thread)
+SCM
+scm_join_thread (SCM thread)
{
return scm_join_thread_timed (thread, SCM_UNDEFINED, SCM_UNDEFINED);
}
@@ -1201,20 +1202,17 @@ fat_mutex_lock (SCM mutex, scm_t_timespec *timeout, int
*ret)
return err;
}
-SCM scm_lock_mutex (SCM mx)
+SCM
+scm_lock_mutex (SCM mx)
{
- return scm_lock_mutex_timed (mx, SCM_UNDEFINED, SCM_UNDEFINED);
+ return scm_timed_lock_mutex (mx, SCM_UNDEFINED);
}
-SCM_DEFINE (scm_lock_mutex_timed, "lock-mutex", 1, 2, 0,
- (SCM m, SCM timeout, SCM owner),
+SCM_DEFINE (scm_timed_lock_mutex, "lock-mutex", 1, 1, 0,
+ (SCM m, SCM timeout),
"Lock mutex @var{m}. If the mutex is already locked, the calling\n"
- "thread blocks until the mutex becomes available. The function\n"
- "returns when the calling thread owns the lock on @var{m}.\n"
- "Locking a mutex that a thread already owns will succeed right\n"
- "away and will not block the thread. That is, Guile's mutexes\n"
- "are @emph{recursive}.")
-#define FUNC_NAME s_scm_lock_mutex_timed
+ "thread blocks until the mutex becomes available.")
+#define FUNC_NAME s_scm_timed_lock_mutex
{
SCM exception;
int ret = 0;
@@ -1228,11 +1226,6 @@ SCM_DEFINE (scm_lock_mutex_timed, "lock-mutex", 1, 2, 0,
waittime = &cwaittime;
}
- if (!SCM_UNBNDP (owner) && !scm_is_false (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, &ret);
if (!scm_is_false (exception))
scm_ithrow (SCM_CAR (exception), scm_list_1 (SCM_CDR (exception)), 1);
@@ -1264,7 +1257,7 @@ scm_dynwind_lock_mutex (SCM mutex)
SCM
scm_try_mutex (SCM mutex)
{
- return scm_lock_mutex_timed (mutex, SCM_INUM0, SCM_UNDEFINED);
+ return scm_timed_lock_mutex (mutex, SCM_INUM0);
}
/*** Fat condition variables */
diff --git a/libguile/threads.h b/libguile/threads.h
index 1da7bbf..ce8148f 100644
--- a/libguile/threads.h
+++ b/libguile/threads.h
@@ -152,7 +152,7 @@ SCM_API SCM scm_make_mutex (void);
SCM_API SCM scm_make_recursive_mutex (void);
SCM_API SCM scm_make_mutex_with_kind (SCM kind);
SCM_API SCM scm_lock_mutex (SCM m);
-SCM_API SCM scm_lock_mutex_timed (SCM m, SCM timeout, SCM owner);
+SCM_API SCM scm_timed_lock_mutex (SCM m, SCM timeout);
SCM_API void scm_dynwind_lock_mutex (SCM mutex);
SCM_API SCM scm_try_mutex (SCM m);
SCM_API SCM scm_unlock_mutex (SCM m);
- [Guile-commits] 01/24: Fix typo in threads documentation, (continued)
- [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, 2016/11/06
- [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 <=
- [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
- [Guile-commits] 24/24: Update NEWS., Andy Wingo, 2016/11/06
- [Guile-commits] 22/24: Update documentation on mutexes, Andy Wingo, 2016/11/06
- [Guile-commits] 20/24: Update mutex documentation, Andy Wingo, 2016/11/06