aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_message.c
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2016-05-26 16:17:45 +0200
committerRickard Green <[email protected]>2016-05-26 16:49:25 +0200
commit8241eb36a733d6fee7c4a6f12c8bdfc206889795 (patch)
treea8270151f11bd96846ae837bd99d72b49522a576 /erts/emulator/beam/erl_message.c
parente5f436615f0649a4d19b03762c016e91e0dce0eb (diff)
downloadotp-8241eb36a733d6fee7c4a6f12c8bdfc206889795.tar.gz
otp-8241eb36a733d6fee7c4a6f12c8bdfc206889795.tar.bz2
otp-8241eb36a733d6fee7c4a6f12c8bdfc206889795.zip
Fix message queue update on replacement and removal of message
Diffstat (limited to 'erts/emulator/beam/erl_message.c')
-rw-r--r--erts/emulator/beam/erl_message.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/erts/emulator/beam/erl_message.c b/erts/emulator/beam/erl_message.c
index 579f6e427d..b761522d91 100644
--- a/erts/emulator/beam/erl_message.c
+++ b/erts/emulator/beam/erl_message.c
@@ -1371,10 +1371,10 @@ erts_prep_msgq_for_inspection(Process *c_p, Process *rp,
mpp = i == 0 ? &rp->msg.first : &mip[i-1].msgp->next;
- if (rp->msg.save == &bad_mp->next)
- rp->msg.save = mpp;
- if (rp->msg.last == &bad_mp->next)
- rp->msg.last = mpp;
+ ASSERT((*mpp)->next == bad_mp);
+
+ erts_msgq_update_internal_pointers(&rp->msg, mpp, &bad_mp->next);
+
mp = mp->next;
*mpp = mp;
rp->msg.len--;
@@ -1411,12 +1411,7 @@ erts_prep_msgq_for_inspection(Process *c_p, Process *rp,
sys_memcpy((void *) tmp->m, (void *) mp->m,
sizeof(Eterm)*ERL_MESSAGE_REF_ARRAY_SZ);
mpp = i == 0 ? &rp->msg.first : &mip[i-1].msgp->next;
- tmp->next = mp->next;
- if (rp->msg.save == &mp->next)
- rp->msg.save = &tmp->next;
- if (rp->msg.last == &mp->next)
- rp->msg.last = &tmp->next;
- *mpp = tmp;
+ erts_msgq_replace_msg_ref(&rp->msg, tmp, mpp);
erts_save_message_in_proc(rp, mp);
mp = tmp;
}