current-future now returns #f if not inside a future, instead of null. Added documentation for current-future.

This commit is contained in:
James Swaine 2010-08-19 09:36:25 -05:00
parent 50d5dc352e
commit 1a2c0546a6
2 changed files with 8 additions and 2 deletions

View File

@ -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?]{

View File

@ -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)))])