diff --git a/src/runtime2/runtime.rs b/src/runtime2/runtime.rs index 5c6ec8c980e4c03212e62d4123cdac96b437f0a2..4f2a18d823c102b3582bfd433ff9c2ae37619d4c 100644 --- a/src/runtime2/runtime.rs +++ b/src/runtime2/runtime.rs @@ -5,7 +5,7 @@ use std::collections::VecDeque; use crate::protocol::*; use super::communication::Message; -use super::component::{wake_up_if_sleeping, CompPDL, CompCtx}; +use super::component::{Component, wake_up_if_sleeping, CompPDL, CompCtx}; use super::store::{ComponentStore, ComponentReservation, QueueDynMpsc, QueueDynProducer}; use super::scheduler::*; @@ -53,11 +53,12 @@ impl CompReserved { } } -/// Private fields of a component, may only be modified by a single thread at -/// a time. +/// Representation of a runtime component. Contains the bookkeeping variables +/// for the schedulers, the publicly accessible fields, and the private fields +/// that should only be accessed by the thread running the component's routine. pub(crate) struct RuntimeComp { pub public: CompPublic, - pub code: CompPDL, + pub component: Box, pub ctx: CompCtx, pub inbox: QueueDynMpsc, pub exiting: bool, @@ -246,9 +247,9 @@ impl RuntimeInner { return CompReserved{ reservation }; } - pub(crate) fn finish_create_pdl_component( + pub(crate) fn finish_create_pdl_component( &self, reserved: CompReserved, - component: CompPDL, mut context: CompCtx, initially_sleeping: bool, + component: C, mut context: CompCtx, initially_sleeping: bool, ) -> (CompKey, &mut RuntimeComp) { let inbox_queue = QueueDynMpsc::new(16); let inbox_producer = inbox_queue.producer(); @@ -261,7 +262,7 @@ impl RuntimeInner { num_handles: AtomicU32::new(1), // the component itself acts like a handle inbox: inbox_producer, }, - code: component, + component: Box::new(component), ctx: context, inbox: inbox_queue, exiting: false,