This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GNU Guile".
http://git.savannah.gnu.org/cgit/guile.git/commit/?id=2a1d8403c07704a40279e58373e6605e0c1f6dd7 The branch, stable-2.0 has been updated via 2a1d8403c07704a40279e58373e6605e0c1f6dd7 (commit) via 8b12a34c8f13d9b2917ffbecc5d59151e5d38a5b (commit) from 79a9a2c271f18d1cd2031b23c682dadd0cf31bae (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 2a1d8403c07704a40279e58373e6605e0c1f6dd7 Author: Mark H Weaver <[email protected]> Date: Mon Jun 10 02:05:17 2013 -0400 Allow #f as timeout argument to unlock-mutex and SRFI-18 mutex-unlock! Reported by Chaos Eternal <[email protected]> Based on a patch by Nala Ginrut <[email protected]> * libguile/threads.c (scm_unlock_mutex_timed): If 'timeout' argument is false, interpret that as no timeout. * doc/ref/api-scheduling.texi (Mutexes and Condition Variables): Update documentation. commit 8b12a34c8f13d9b2917ffbecc5d59151e5d38a5b Author: Mark H Weaver <[email protected]> Date: Mon Jun 10 02:26:11 2013 -0400 Fix tests for 'scm_c_bind_keyword_arguments'. * test-suite/standalone/test-scm-c-bind-keyword-arguments.c (error_handler): Remove function. (unrecognized_keyword_error_handler, invalid_keyword_error_handler, odd_length_error_handler): New functions. (test_scm_c_bind_keyword_arguments): Use new error handler functions. ----------------------------------------------------------------------- Summary of changes: doc/ref/api-scheduling.texi | 6 +- libguile/threads.c | 2 +- .../standalone/test-scm-c-bind-keyword-arguments.c | 65 ++++++++++++++----- 3 files changed, 52 insertions(+), 21 deletions(-) diff --git a/doc/ref/api-scheduling.texi b/doc/ref/api-scheduling.texi index b230821..0d036be 100644 --- a/doc/ref/api-scheduling.texi +++ b/doc/ref/api-scheduling.texi @@ -446,9 +446,9 @@ which the calling thread will wait to be signalled before returning. @code{wait-condition-variable}, except that the mutex is left in an unlocked state when the function returns.) -When @var{timeout} is also given, it specifies a point in time where -the waiting should be aborted. It can be either an integer as -returned by @code{current-time} or a pair as returned by +When @var{timeout} is also given and not false, it specifies a point in +time where the waiting should be aborted. It can be either an integer +as returned by @code{current-time} or a pair as returned by @code{gettimeofday}. When the waiting is aborted, @code{#f} is returned. Otherwise the function returns @code{#t}. @end deffn diff --git a/libguile/threads.c b/libguile/threads.c index 04897e3..c594791 100644 --- a/libguile/threads.c +++ b/libguile/threads.c @@ -1696,7 +1696,7 @@ SCM_DEFINE (scm_unlock_mutex_timed, "unlock-mutex", 1, 2, 0, { SCM_VALIDATE_CONDVAR (2, cond); - if (! (SCM_UNBNDP (timeout))) + if (! SCM_UNBNDP (timeout) && ! scm_is_false (timeout)) { to_timespec (timeout, &cwaittime); waittime = &cwaittime; diff --git a/test-suite/standalone/test-scm-c-bind-keyword-arguments.c b/test-suite/standalone/test-scm-c-bind-keyword-arguments.c index 6fcf821..ad0722c 100644 --- a/test-suite/standalone/test-scm-c-bind-keyword-arguments.c +++ b/test-suite/standalone/test-scm-c-bind-keyword-arguments.c @@ -25,20 +25,6 @@ #include <assert.h> static SCM -error_handler (void *data, SCM key, SCM args) -{ - SCM expected_args = scm_list_n (scm_from_utf8_string ("test"), - scm_from_utf8_string ((char *) data), - SCM_EOL, SCM_BOOL_F, - SCM_UNDEFINED); - - assert (scm_is_eq (key, scm_from_utf8_symbol ("keyword-argument-error"))); - assert (scm_is_true (scm_equal_p (args, expected_args))); - - return SCM_BOOL_T; -} - -static SCM test_unrecognized_keyword (void *data) { SCM k_foo = scm_from_utf8_keyword ("foo"); @@ -58,6 +44,21 @@ test_unrecognized_keyword (void *data) } static SCM +unrecognized_keyword_error_handler (void *data, SCM key, SCM args) +{ + SCM expected_args = scm_list_n + (scm_from_utf8_string ("test"), + scm_from_utf8_string ("Unrecognized keyword"), + SCM_EOL, scm_list_1 (scm_from_utf8_keyword ("baz")), + SCM_UNDEFINED); + + assert (scm_is_eq (key, scm_from_utf8_symbol ("keyword-argument-error"))); + assert (scm_is_true (scm_equal_p (args, expected_args))); + + return SCM_BOOL_T; +} + +static SCM test_invalid_keyword (void *data) { SCM k_foo = scm_from_utf8_keyword ("foo"); @@ -76,6 +77,21 @@ test_invalid_keyword (void *data) } static SCM +invalid_keyword_error_handler (void *data, SCM key, SCM args) +{ + SCM expected_args = scm_list_n + (scm_from_utf8_string ("test"), + scm_from_utf8_string ("Invalid keyword"), + SCM_EOL, scm_list_1 (SCM_INUM0), + SCM_UNDEFINED); + + assert (scm_is_eq (key, scm_from_utf8_symbol ("keyword-argument-error"))); + assert (scm_is_true (scm_equal_p (args, expected_args))); + + return SCM_BOOL_T; +} + +static SCM test_odd_length (void *data) { SCM k_foo = scm_from_utf8_keyword ("foo"); @@ -93,6 +109,21 @@ test_odd_length (void *data) assert (0); } +static SCM +odd_length_error_handler (void *data, SCM key, SCM args) +{ + SCM expected_args = scm_list_n + (scm_from_utf8_string ("test"), + scm_from_utf8_string ("Odd length of keyword argument list"), + SCM_EOL, SCM_BOOL_F, + SCM_UNDEFINED); + + assert (scm_is_eq (key, scm_from_utf8_symbol ("keyword-argument-error"))); + assert (scm_is_true (scm_equal_p (args, expected_args))); + + return SCM_BOOL_T; +} + static void test_scm_c_bind_keyword_arguments () { @@ -174,17 +205,17 @@ test_scm_c_bind_keyword_arguments () /* Test unrecognized keyword error. */ scm_internal_catch (SCM_BOOL_T, test_unrecognized_keyword, NULL, - error_handler, "Unrecognized keyword"); + unrecognized_keyword_error_handler, NULL); /* Test invalid keyword error. */ scm_internal_catch (SCM_BOOL_T, test_invalid_keyword, NULL, - error_handler, "Invalid keyword"); + invalid_keyword_error_handler, NULL); /* Test odd length error. */ scm_internal_catch (SCM_BOOL_T, test_odd_length, NULL, - error_handler, "Odd length of keyword argument list"); + odd_length_error_handler, NULL); } static void hooks/post-receive -- GNU Guile
