aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2014-03-31 18:44:50 +0200
committerSverker Eriksson <[email protected]>2014-03-31 18:44:50 +0200
commit3817722d82b5ca2bdc880bb5f463a94c382eddaa (patch)
treea746d25cfcd075c7f874a5fd972ff3f0d201e084 /erts/emulator
parentaceb0f52a741cb805edcb6bcccc5d9ad6a84c5ff (diff)
parent56018ef95e70c5630c1c6fe16d22b54f8ecd0791 (diff)
downloadotp-3817722d82b5ca2bdc880bb5f463a94c382eddaa.tar.gz
otp-3817722d82b5ca2bdc880bb5f463a94c382eddaa.tar.bz2
otp-3817722d82b5ca2bdc880bb5f463a94c382eddaa.zip
Merge branch 'sverk/suspend-running-race'
* sverk/suspend-running-race: erts: Fix bug of scheduling a suspended process
Diffstat (limited to 'erts/emulator')
-rw-r--r--erts/emulator/beam/erl_process.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/erts/emulator/beam/erl_process.c b/erts/emulator/beam/erl_process.c
index 8bf0cc9491..b4b97d7df1 100644
--- a/erts/emulator/beam/erl_process.c
+++ b/erts/emulator/beam/erl_process.c
@@ -9207,7 +9207,6 @@ Process *schedule(Process *p, int calls)
*/
pick_next_process: {
erts_aint32_t psflg_band_mask;
- erts_aint32_t running_flag;
int prio_q;
int qmask;
@@ -9269,12 +9268,6 @@ Process *schedule(Process *p, int calls)
state = erts_smp_atomic32_read_nob(&p->state);
}
-
- if (state & ERTS_PSFLG_ACTIVE_SYS)
- running_flag = ERTS_PSFLG_RUNNING_SYS;
- else
- running_flag = ERTS_PSFLG_RUNNING;
-
while (1) {
erts_aint32_t exp, new, tmp;
tmp = new = exp = state;
@@ -9284,8 +9277,12 @@ Process *schedule(Process *p, int calls)
tmp = state & (ERTS_PSFLG_SUSPENDED
| ERTS_PSFLG_PENDING_EXIT
| ERTS_PSFLG_ACTIVE_SYS);
- if (tmp != ERTS_PSFLG_SUSPENDED)
- new |= running_flag;
+ if (tmp != ERTS_PSFLG_SUSPENDED) {
+ if (state & ERTS_PSFLG_ACTIVE_SYS)
+ new |= ERTS_PSFLG_RUNNING_SYS;
+ else
+ new |= ERTS_PSFLG_RUNNING;
+ }
}
state = erts_smp_atomic32_cmpxchg_relb(&p->state, new, exp);
if (state == exp) {