LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File 0483-erts-Make-enif_consume_timeslice-no-op-on-dirty-sche.patch of Package erlang (Project home:Ledest:erlang:20)

From 2697f7d469d2cb0944af976b4f4ac7f5db0dc6aa Mon Sep 17 00:00:00 2001
From: Sverker Eriksson <sverker@erlang.org>
Date: Mon, 18 Feb 2019 20:08:27 +0100
Subject: [PATCH] erts: Make enif_consume_timeslice no-op on dirty sched

---
 erts/emulator/beam/erl_nif.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

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;
-- 
2.16.4