diff options
author | Rickard Green <[email protected]> | 2011-04-08 14:50:26 +0200 |
---|---|---|
committer | Rickard Green <[email protected]> | 2011-04-11 17:29:39 +0200 |
commit | 031fd45d17d4887fdd437ae73608e55e76660781 (patch) | |
tree | d30bae310bd875eb896850396cbf50b4a21a1eb7 /erts/emulator/beam/beam_bif_load.c | |
parent | b7ecdcd1ae9e11b8f75e11b82d94da32837932bc (diff) | |
download | otp-031fd45d17d4887fdd437ae73608e55e76660781.tar.gz otp-031fd45d17d4887fdd437ae73608e55e76660781.tar.bz2 otp-031fd45d17d4887fdd437ae73608e55e76660781.zip |
Avoid scheduling of processes being garbage collected by others
Diffstat (limited to 'erts/emulator/beam/beam_bif_load.c')
-rw-r--r-- | erts/emulator/beam/beam_bif_load.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/erts/emulator/beam/beam_bif_load.c b/erts/emulator/beam/beam_bif_load.c index 6ae9736141..b6893ff547 100644 --- a/erts/emulator/beam/beam_bif_load.c +++ b/erts/emulator/beam/beam_bif_load.c @@ -175,8 +175,12 @@ check_process_code_2(BIF_ALIST_2) Eterm res; if (internal_pid_index(BIF_ARG_1) >= erts_max_processes) goto error; - rp = erts_pid2proc_not_running(BIF_P, ERTS_PROC_LOCK_MAIN, - BIF_ARG_1, ERTS_PROC_LOCK_MAIN); +#ifdef ERTS_SMP + rp = erts_pid2proc_suspend(BIF_P, ERTS_PROC_LOCK_MAIN, + BIF_ARG_1, ERTS_PROC_LOCK_MAIN); +#else + rp = erts_pid2proc(BIF_P, 0, BIF_ARG_1, 0); +#endif if (!rp) { BIF_RET(am_false); } @@ -187,8 +191,10 @@ check_process_code_2(BIF_ALIST_2) modp = erts_get_module(BIF_ARG_2); res = check_process_code(rp, modp); #ifdef ERTS_SMP - if (BIF_P != rp) + if (BIF_P != rp) { + erts_resume(rp, ERTS_PROC_LOCK_MAIN); erts_smp_proc_unlock(rp, ERTS_PROC_LOCK_MAIN); + } #endif BIF_RET(res); } |