mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-30 06:50:31 +02:00
srfi-18: Use lambda* optional arguments.
* module/srfi/srfi-18.scm (make-mutex, make-condition-variable): Use optional arguments.
This commit is contained in:
parent
bbcc128153
commit
7078218a92
1 changed files with 10 additions and 12 deletions
|
@ -282,13 +282,12 @@
|
||||||
;; MUTEXES
|
;; MUTEXES
|
||||||
;; These functions are all pass-thrus to the existing Guile implementations.
|
;; These functions are all pass-thrus to the existing Guile implementations.
|
||||||
|
|
||||||
(define make-mutex
|
(define* (make-mutex #:optional name)
|
||||||
(lambda name
|
(let ((m (threads:make-mutex 'unchecked-unlock
|
||||||
(let ((n (and (pair? name) (car name)))
|
|
||||||
(m (threads:make-mutex 'unchecked-unlock
|
|
||||||
'allow-external-unlock
|
'allow-external-unlock
|
||||||
'recursive)))
|
'recursive)))
|
||||||
(and n (hashq-set! object-names m n)) m)))
|
(when name (hashq-set! object-names m name))
|
||||||
|
m))
|
||||||
|
|
||||||
(define (mutex-name mutex)
|
(define (mutex-name mutex)
|
||||||
(hashq-ref object-names (check-arg-type threads:mutex? mutex "mutex-name")))
|
(hashq-ref object-names (check-arg-type threads:mutex? mutex "mutex-name")))
|
||||||
|
@ -323,11 +322,10 @@
|
||||||
;; CONDITION VARIABLES
|
;; CONDITION VARIABLES
|
||||||
;; These functions are all pass-thrus to the existing Guile implementations.
|
;; These functions are all pass-thrus to the existing Guile implementations.
|
||||||
|
|
||||||
(define make-condition-variable
|
(define* (make-condition-variable #:optional name)
|
||||||
(lambda name
|
(let ((m (threads:make-condition-variable)))
|
||||||
(let ((n (and (pair? name) (car name)))
|
(when name (hashq-set! object-names m name))
|
||||||
(m (threads:make-condition-variable)))
|
m))
|
||||||
(and n (hashq-set! object-names m n)) m)))
|
|
||||||
|
|
||||||
(define (condition-variable-name condition-variable)
|
(define (condition-variable-name condition-variable)
|
||||||
(hashq-ref object-names (check-arg-type threads:condition-variable?
|
(hashq-ref object-names (check-arg-type threads:condition-variable?
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue