diff options
author | Sverker Eriksson <[email protected]> | 2019-02-20 17:34:14 +0100 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2019-02-20 17:34:14 +0100 |
commit | c10cd657148d71c742c129c4a6ec64d22638102e (patch) | |
tree | 66e45366c1a09d64d9627d814ad7b4f21948dbcb | |
parent | c14e3dcce779feb3ef254a08acedae60108ad3ac (diff) | |
parent | 2697f7d469d2cb0944af976b4f4ac7f5db0dc6aa (diff) | |
download | otp-c10cd657148d71c742c129c4a6ec64d22638102e.tar.gz otp-c10cd657148d71c742c129c4a6ec64d22638102e.tar.bz2 otp-c10cd657148d71c742c129c4a6ec64d22638102e.zip |
Merge branch 'sverker/enif_consume_timeslice-dirty-nop/OTP-15604' into maint
* sverker/enif_consume_timeslice-dirty-nop/OTP-15604:
erts: Make enif_consume_timeslice no-op on dirty sched
-rw-r--r-- | erts/emulator/beam/erl_nif.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/erts/emulator/beam/erl_nif.c b/erts/emulator/beam/erl_nif.c index 17041cc91c..ebef485b04 100644 --- a/erts/emulator/beam/erl_nif.c +++ b/erts/emulator/beam/erl_nif.c @@ -2701,8 +2701,12 @@ int enif_consume_timeslice(ErlNifEnv* env, int percent) { Process *proc; Sint reds; + int sched; - execution_state(env, &proc, NULL); + execution_state(env, &proc, &sched); + + if (sched < 0) + return 0; /* no-op on dirty scheduler */ ASSERT(is_proc_bound(env) && percent >= 1 && percent <= 100); if (percent < 1) percent = 1; |