diff options
author | Lukas Larsson <[email protected]> | 2018-04-10 10:17:30 +0200 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2018-04-10 10:17:30 +0200 |
commit | 994a1229418c34846c1e2b5d08e72aa30ac5fa5f (patch) | |
tree | c6569886fcaa63a8af02455c5ff5953c79e5d260 /erts/preloaded/src/init.erl | |
parent | 4c29e451d8839fbfd3733444640a761c2c9b1f2a (diff) | |
download | otp-994a1229418c34846c1e2b5d08e72aa30ac5fa5f.tar.gz otp-994a1229418c34846c1e2b5d08e72aa30ac5fa5f.tar.bz2 otp-994a1229418c34846c1e2b5d08e72aa30ac5fa5f.zip |
erts: Flush messages before doing init restart
If messages are not flushed they would cause problems when
the system is booting. For instance module load requests
would be issued before the prim loader has been launched.
Diffstat (limited to 'erts/preloaded/src/init.erl')
-rw-r--r-- | erts/preloaded/src/init.erl | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/erts/preloaded/src/init.erl b/erts/preloaded/src/init.erl index e0ae6b1656..0c74169e97 100644 --- a/erts/preloaded/src/init.erl +++ b/erts/preloaded/src/init.erl @@ -545,6 +545,8 @@ stop(Reason,State) -> do_stop(Reason,State1). do_stop(restart,#state{start = Start, flags = Flags, args = Args}) -> + %% Make sure we don't have any outstanding messages before doing the restart. + flush(), boot(Start,Flags,Args); do_stop(reboot,_) -> halt(); @@ -560,6 +562,13 @@ clear_system(BootPid,State) -> shutdown_pids(Heart,BootPid,State), unload(Heart). +flush() -> + receive + _M -> flush() + after 0 -> + ok + end. + stop_heart(State) -> case get_heart(State#state.kernel) of false -> |