diff options
author | Andy Wingo <wingo@pobox.com> | 2016-10-30 21:43:08 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2016-10-30 21:43:08 +0100 |
commit | 4d23c835c4373355e9d6ccd80cc8fe431f4551b9 (patch) | |
tree | bb9ceda5d94b3a3a2a52544c66565a691961f3fa /module/srfi | |
parent | 501c0e67b1977136a6e7677de007e5301f55adda (diff) | |
download | guile-4d23c835c4373355e9d6ccd80cc8fe431f4551b9.tar.gz |
srfi-18: Use `match' in thread-start!.
* module/srfi/srfi-18.scm (thread-start!): Use `match'.
Diffstat (limited to 'module/srfi')
-rw-r--r-- | module/srfi/srfi-18.scm | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/module/srfi/srfi-18.scm b/module/srfi/srfi-18.scm index 756508c88..adad0d987 100644 --- a/module/srfi/srfi-18.scm +++ b/module/srfi/srfi-18.scm @@ -32,6 +32,7 @@ (define-module (srfi srfi-18) #:use-module ((ice-9 threads) #:prefix threads:) + #:use-module (ice-9 match) #:use-module (srfi srfi-34) #:export (;; Threads make-thread @@ -210,15 +211,15 @@ *unspecified*) (define (thread-start! thread) - (let ((x (hashq-ref thread-start-conds - (check-arg-type threads:thread? thread "thread-start!")))) - (and x (let ((smutex (car x)) - (scond (cdr x))) - (hashq-remove! thread-start-conds thread) - (threads:lock-mutex smutex) - (threads:signal-condition-variable scond) - (threads:unlock-mutex smutex))) - thread)) + (match (hashq-ref thread-start-conds + (check-arg-type threads:thread? thread "thread-start!")) + ((smutex . scond) + (hashq-remove! thread-start-conds thread) + (threads:lock-mutex smutex) + (threads:signal-condition-variable scond) + (threads:unlock-mutex smutex)) + (#f #f)) + thread) (define (thread-yield!) (threads:yield) *unspecified*) |