fix `delay/thread' error when promise-running thread terminates
This commit is contained in:
parent
6039e35afd
commit
b4fea2ff36
|
@ -98,9 +98,13 @@
|
|||
(lambda (p)
|
||||
(reify-result (let ([v (pref p)])
|
||||
(if (running-thread? v)
|
||||
(begin (thread-wait (running-thread-thread v))
|
||||
(pref p))
|
||||
v))))
|
||||
(let ([t (running-thread-thread v)])
|
||||
(thread-wait t)
|
||||
(let ([v (pref p)])
|
||||
(if (running-thread? v)
|
||||
(error 'force "promise's thread terminated without result or exception\n promise: ~e" p)
|
||||
v)))
|
||||
v))))
|
||||
#:property prop:evt
|
||||
(lambda (p)
|
||||
(let ([v (pref p)])
|
||||
|
|
|
@ -111,7 +111,10 @@ group} specified by @racket[thread-group-expr], which defaults to
|
|||
appear at most once.
|
||||
|
||||
Exceptions raised by the @racket[body]s are caught as usual and raised
|
||||
only when the promise is @racket[force]d.}
|
||||
only when the promise is @racket[force]d. Unlike @racket[delay/sync],
|
||||
if the thread running @racket[body] terminates without producing a result
|
||||
or exception, @racket[force] of the promise raises an exception (instead
|
||||
of blocking).}
|
||||
|
||||
@defform/subs[(delay/idle body/option ...+)
|
||||
([body/option body
|
||||
|
|
Loading…
Reference in New Issue
Block a user