aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2010-06-03 12:44:29 +0000
committerErlang/OTP <[email protected]>2010-06-03 12:44:29 +0000
commitcbd1378ee1fde835e55614bac9290b281bafe49a (patch)
treec1b1a4756715ea8a2d1b07874aa22950049a9787
parent17808d2471632beeb7b23b5456712cad7a5ac255 (diff)
downloadotp-cbd1378ee1fde835e55614bac9290b281bafe49a.tar.gz
otp-cbd1378ee1fde835e55614bac9290b281bafe49a.tar.bz2
otp-cbd1378ee1fde835e55614bac9290b281bafe49a.zip
OTP-8675 Fix erroneous return value from erlang:system_info(multi_scheduling)
erlang:system_info(multi_scheduling) sometimes erroneously returned enabled when it should have returned blocked.
-rw-r--r--erts/emulator/beam/erl_process.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/erts/emulator/beam/erl_process.c b/erts/emulator/beam/erl_process.c
index 5be77de7bb..055733ac49 100644
--- a/erts/emulator/beam/erl_process.c
+++ b/erts/emulator/beam/erl_process.c
@@ -2778,7 +2778,7 @@ erts_block_multi_scheduling(Process *p, ErtsProcLocks plocks, int on, int all)
res = ERTS_SCHDLR_SSPND_YIELD_RESTART; /* Yield */
}
else if (on) { /* ------ BLOCK ------ */
- if (erts_is_multi_scheduling_blocked()) {
+ if (schdlr_sspnd.msb.procs) {
plp = proclist_create(p);
plp->next = schdlr_sspnd.msb.procs;
schdlr_sspnd.msb.procs = plp;
@@ -2984,8 +2984,11 @@ erts_dbg_multi_scheduling_return_trap(Process *p, Eterm return_value)
int
erts_is_multi_scheduling_blocked(void)
{
- return (erts_smp_atomic_read(&schdlr_sspnd.msb.ongoing)
- && erts_smp_atomic_read(&schdlr_sspnd.active) == 1);
+ int res;
+ erts_smp_mtx_lock(&schdlr_sspnd.mtx);
+ res = schdlr_sspnd.msb.procs != NULL;
+ erts_smp_mtx_unlock(&schdlr_sspnd.mtx);
+ return res;
}
Eterm
@@ -2994,7 +2997,7 @@ erts_multi_scheduling_blockers(Process *p)
Eterm res = NIL;
erts_smp_mtx_lock(&schdlr_sspnd.mtx);
- if (erts_is_multi_scheduling_blocked()) {
+ if (schdlr_sspnd.msb.procs) {
Eterm *hp, *hp_end;
ErtsProcList *plp1, *plp2;
Uint max_size;