diff --git a/src/runtime2/scheduler.rs b/src/runtime2/scheduler.rs index eb8ccbae8bcebfe6e4c6279c845c0c23e0065445..092b65f090107f47fe0c48f9656a99c6f473e2e6 100644 --- a/src/runtime2/scheduler.rs +++ b/src/runtime2/scheduler.rs @@ -296,8 +296,9 @@ impl Scheduler { if scheduled.ctx.is_in_sync { // Just entered sync region } else { - // Just left sync region. So clear inbox - scheduled.ctx.inbox_messages.clear(); + // Just left sync region. So clear inbox up until the last + // message that was read. + scheduled.ctx.inbox_messages.drain(0..scheduled.ctx.inbox_len_read); scheduled.ctx.inbox_len_read = 0; } @@ -380,7 +381,7 @@ pub(crate) struct ComponentCtx { // Mostly managed by the scheduler pub(crate) id: ConnectorId, ports: Vec, - inbox_messages: Vec, // never control or ping messages + inbox_messages: Vec, inbox_len_read: usize, // Submitted by the component is_in_sync: bool,