Permalink
Browse files

Bug fix: FORCE no longer tries to stop computation if it has not started

  • Loading branch information...
1 parent 298c7c4 commit c8548a9470cdfea7270f05df04df5a3376e65bb7 @StrmSrfr StrmSrfr committed Nov 16, 2011
Showing with 7 additions and 1 deletion.
  1. +1 −1 future.lisp
  2. +6 −0 test/test.lisp
View
@@ -31,7 +31,7 @@ computation of the future)."
(return-from force nil)
(setf (%values future) values)))
(with-slots (computing-thread) future
- (unless (eq computing-thread (current-thread))
+ (unless (or (null computing-thread) (eq computing-thread (current-thread)))
(abort-scheduled-future-task computing-thread (future-id future)))
(dolist (x (wait-list future))
(with-lock-held ((car x))
View
@@ -75,6 +75,12 @@
(sleep 0.2)
(and flag (yield foo))))))
+(test force-unstarted
+ (is (= 1
+ (let ((future (pcall (constantly 5) :lazy)))
+ (force future 1)
+ (yield future)))))
+
(test gc-future
(is (= 1
(let ((foo 1))

0 comments on commit c8548a9

Please sign in to comment.