[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 06/17: srfi-18: Use lambda* optional arguments.
From: |
Andy Wingo |
Subject: |
[Guile-commits] 06/17: srfi-18: Use lambda* optional arguments. |
Date: |
Mon, 31 Oct 2016 21:39:37 +0000 (UTC) |
wingo pushed a commit to branch master
in repository guile.
commit 7078218a9283877841983e22c6e4f5bb734d9288
Author: Andy Wingo <address@hidden>
Date: Sun Oct 30 21:44:35 2016 +0100
srfi-18: Use lambda* optional arguments.
* module/srfi/srfi-18.scm (make-mutex, make-condition-variable): Use
optional arguments.
---
module/srfi/srfi-18.scm | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/module/srfi/srfi-18.scm b/module/srfi/srfi-18.scm
index b3a0643..6d74346 100644
--- a/module/srfi/srfi-18.scm
+++ b/module/srfi/srfi-18.scm
@@ -282,13 +282,12 @@
;; MUTEXES
;; These functions are all pass-thrus to the existing Guile implementations.
-(define make-mutex
- (lambda name
- (let ((n (and (pair? name) (car name)))
- (m (threads:make-mutex 'unchecked-unlock
- 'allow-external-unlock
- 'recursive)))
- (and n (hashq-set! object-names m n)) m)))
+(define* (make-mutex #:optional name)
+ (let ((m (threads:make-mutex 'unchecked-unlock
+ 'allow-external-unlock
+ 'recursive)))
+ (when name (hashq-set! object-names m name))
+ m))
(define (mutex-name mutex)
(hashq-ref object-names (check-arg-type threads:mutex? mutex "mutex-name")))
@@ -323,11 +322,10 @@
;; CONDITION VARIABLES
;; These functions are all pass-thrus to the existing Guile implementations.
-(define make-condition-variable
- (lambda name
- (let ((n (and (pair? name) (car name)))
- (m (threads:make-condition-variable)))
- (and n (hashq-set! object-names m n)) m)))
+(define* (make-condition-variable #:optional name)
+ (let ((m (threads:make-condition-variable)))
+ (when name (hashq-set! object-names m name))
+ m))
(define (condition-variable-name condition-variable)
(hashq-ref object-names (check-arg-type threads:condition-variable?
- [Guile-commits] branch master updated (c957ec7 -> eeeee32), Andy Wingo, 2016/10/31
- [Guile-commits] 05/17: srfi-18: Simplify thread-sleep!, thread-terminate!., Andy Wingo, 2016/10/31
- [Guile-commits] 04/17: srfi-18: Use `match' in thread-start!., Andy Wingo, 2016/10/31
- [Guile-commits] 06/17: srfi-18: Use lambda* optional arguments.,
Andy Wingo <=
- [Guile-commits] 07/17: srfi-18: Use parameters., Andy Wingo, 2016/10/31
- [Guile-commits] 10/17: srfi-18: Avoid call/cc., Andy Wingo, 2016/10/31
- [Guile-commits] 11/17: Rationalize exception handling in srfi-18, Andy Wingo, 2016/10/31
- [Guile-commits] 17/17: Remove thread cleanup facility, Andy Wingo, 2016/10/31
- [Guile-commits] 02/17: Fix srfi-34 indentation, Andy Wingo, 2016/10/31
- [Guile-commits] 12/17: Refactor thread-join! to use optional args., Andy Wingo, 2016/10/31
- [Guile-commits] 13/17: Trim srfi-18 thread startup machinery, Andy Wingo, 2016/10/31
- [Guile-commits] 14/17: cancel-thread can take arguments, Andy Wingo, 2016/10/31
- [Guile-commits] 03/17: srfi-18: Improve style., Andy Wingo, 2016/10/31
- [Guile-commits] 15/17: srfi-18: thread-terminate! without cleanup handlers, Andy Wingo, 2016/10/31