Permalink
Browse files

Merge pull request #3 from StrmSrfr/master

Bug fix: FORCE no longer tries to stop computation if it has not started
  • Loading branch information...
2 parents b0feadc + 786843d commit 42c43f91480ee9bde943e56c17892e499ac724fb @vsedach committed Feb 22, 2013
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 42c43f9

Please sign in to comment.