current-future now returns #f if not inside a future, instead of null. Added documentation for current-future.
This commit is contained in:
parent
50d5dc352e
commit
1a2c0546a6
|
@ -66,6 +66,13 @@ in parallel. See also @guidesecref["effective-futures"].
|
|||
(let ([f (future (lambda () (+ 1 2)))])
|
||||
(list (+ 3 4) (touch f)))
|
||||
]}
|
||||
|
||||
|
||||
@defproc[(current-future) any]{
|
||||
Returns the descriptor for the future that is evaluating the current thunk.
|
||||
If not currently running inside a future thunk (or
|
||||
futures are disabled), returns @racket[#f].
|
||||
}
|
||||
|
||||
|
||||
@defproc[(future? [v any/c]) boolean?]{
|
||||
|
|
|
@ -149,8 +149,7 @@ We should also test deep continuations.
|
|||
(continuation-mark-set->list (current-continuation-marks) 'x))))
|
||||
|
||||
;Tests for current-future
|
||||
(check-equal? '() (current-future))
|
||||
(check-equal? #t (null? (current-future)))
|
||||
(check-equal? #f (current-future))
|
||||
(check-equal? #t (equal? (current-future) (current-future)))
|
||||
|
||||
(let ([f (future (λ () (current-future)))])
|
||||
|
|
Loading…
Reference in New Issue
Block a user