From 1a2c0546a6529497630a5c79d92e265a81e599ae Mon Sep 17 00:00:00 2001 From: James Swaine Date: Thu, 19 Aug 2010 09:36:25 -0500 Subject: [PATCH] current-future now returns #f if not inside a future, instead of null. Added documentation for current-future. --- collects/scribblings/reference/futures.scrbl | 7 +++++++ collects/tests/future/future.rkt | 3 +-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/collects/scribblings/reference/futures.scrbl b/collects/scribblings/reference/futures.scrbl index cf65a29323..a612a637e5 100644 --- a/collects/scribblings/reference/futures.scrbl +++ b/collects/scribblings/reference/futures.scrbl @@ -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?]{ diff --git a/collects/tests/future/future.rkt b/collects/tests/future/future.rkt index 7c657fb609..dbcc24eb14 100644 --- a/collects/tests/future/future.rkt +++ b/collects/tests/future/future.rkt @@ -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)))])