File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -327,6 +327,12 @@ var Aff = function () {
327327 }
328328 runTick ++ ;
329329 Scheduler . enqueue ( function ( ) {
330+ // It's possible to interrupt the fiber between enqueuing and
331+ // resuming, so we need to check that the runTick is still
332+ // valid.
333+ if ( runTick !== localRunTick + 1 ) {
334+ return ;
335+ }
330336 status = STEP_RESULT ;
331337 step = result ;
332338 run ( runTick ) ;
Original file line number Diff line number Diff line change @@ -660,6 +660,13 @@ test_regression_bracket_catch_cleanup = assert "regression/bracket-catch-cleanup
660660 (\_ → throwError (error " Nope." ))
661661 pure $ lmap message res == Left " Nope."
662662
663+ test_regression_kill_sync_async ∷ Aff Unit
664+ test_regression_kill_sync_async = assert " regression/kill-sync-async" do
665+ ref ← newRef " "
666+ f1 ← forkAff $ makeAff \k -> k (Left (error " Boom." )) *> mempty
667+ killFiber (error " Nope." ) f1
668+ pure true
669+
663670main ∷ Effect Unit
664671main = do
665672 test_pure
@@ -707,3 +714,4 @@ main = do
707714 test_regression_return_fork
708715 test_regression_par_apply_async_canceler
709716 test_regression_bracket_catch_cleanup
717+ test_regression_kill_sync_async
You can’t perform that action at this time.
0 commit comments