Skip to content

Commit

Permalink
fixup! erts: Try fix race in erlang:halt
Browse files Browse the repository at this point in the history
  • Loading branch information
sverker committed Feb 12, 2025
1 parent ea84680 commit a3201e7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions erts/emulator/beam/bif.c
Original file line number Diff line number Diff line change
Expand Up @@ -4304,6 +4304,9 @@ BIF_RETTYPE halt_2(BIF_ALIST_2)
("System halted by BIF halt(%T, %T)\n", BIF_ARG_1, BIF_ARG_2));
if (flush) {
erts_halt(pos_int_code);
/* We lost race against other halt call.
Suspend this process and do a dummy trap while waiting
for other halt call to terminate the beam. */
erts_suspend(BIF_P, ERTS_PROC_LOCK_MAIN, NULL);
ERTS_BIF_YIELD2(BIF_TRAP_EXPORT(BIF_halt_2), BIF_P, am_undefined, am_undefined);
}
Expand Down

0 comments on commit a3201e7

Please sign in to comment.