mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-18 01:30:27 +02:00
srfi-18: 'thread-sleep!' timeout-as-a-number is relative.
This is a followup to <https://bugs.gnu.org/29704>. * module/srfi/srfi-18.scm (thread-sleep!): When TIMEOUT is a number, keep it as-is. * test-suite/tests/srfi-18.test ("thread sleep with number"): Pass 0 as the timeout. ("thread sleeps fractions of a second"): Pass 0.5 as the timeout.
This commit is contained in:
parent
cac14ad34d
commit
898d97d440
2 changed files with 5 additions and 6 deletions
|
@ -235,9 +235,9 @@ object (absolute point in time), or #f."
|
|||
(define (thread-yield!) (threads:yield) *unspecified*)
|
||||
|
||||
(define (thread-sleep! timeout)
|
||||
(let* ((ct (time->seconds (current-time)))
|
||||
(t (cond ((time? timeout) (- (time->seconds timeout) ct))
|
||||
((number? timeout) (- timeout ct))
|
||||
(let* ((t (cond ((time? timeout) (- (time->seconds timeout)
|
||||
(time->seconds (current-time))))
|
||||
((number? timeout) timeout)
|
||||
(else (scm-error 'wrong-type-arg "thread-sleep!"
|
||||
"Wrong type argument: ~S"
|
||||
(list timeout)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue