Skip to content

Fix 'bhead is not a function' for forks #145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Control/Monad/Aff.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,15 +372,15 @@ var Aff = function () {
break;

case FORK:
status = STEP_BIND;
status = STEP_RESULT;
tmp = Fiber(util, supervisor, step._2);
if (supervisor) {
supervisor.register(tmp);
}
if (step._1) {
tmp.run();
}
step = tmp;
step = util.right(tmp);
break;

case SEQ:
Expand Down
10 changes: 9 additions & 1 deletion test/Test/Main.purs
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ test_scheduler_size = assert "scheduler" do
eq 100000 <$> readRef ref

test_lazy ∷ ∀ eff. TestAff eff Unit
test_lazy = assert "Lazy Aff" do
test_lazy = assert "lazy" do
varA ← makeEmptyVar
varB ← makeEmptyVar
fiberA <- forkAff $ fix \loop -> do
Expand All @@ -653,6 +653,13 @@ test_lazy = assert "Lazy Aff" do
putVar 0 varA
eq "done" <$> joinFiber fiberB

test_regression_return_fork ∷ ∀ eff. TestAff eff Unit
test_regression_return_fork = assert "regression/return-fork" do
bracket
(forkAff (pure unit))
(const (pure unit))
(const (pure true))

main ∷ TestEff () Unit
main = do
test_pure
Expand Down Expand Up @@ -698,3 +705,4 @@ main = do
-- Turn on if we decide to schedule forks
-- test_scheduler_size
test_parallel_stack
test_regression_return_fork