diff --git a/src/runtime2/component/component_pdl.rs b/src/runtime2/component/component_pdl.rs index a18aaab3c7e49842356fd65651692255b7743501..338d05bde302f39e2d796e59f12173102be2b09d 100644 --- a/src/runtime2/component/component_pdl.rs +++ b/src/runtime2/component/component_pdl.rs @@ -7,6 +7,7 @@ use crate::protocol::eval::{ EvalContinuation, EvalResult, EvalError }; +use crate::runtime2::runtime::CompId; use crate::runtime2::scheduler::SchedulerCtx; use crate::runtime2::communication::*; @@ -222,7 +223,7 @@ pub(crate) struct CompPDL { } impl Component for CompPDL { - fn on_creation(&mut self, _sched_ctx: &SchedulerCtx) { + fn on_creation(&mut self, _id: CompId, _sched_ctx: &SchedulerCtx) { // Intentionally empty } @@ -591,6 +592,12 @@ impl CompPDL { // Handling ports // ------------------------------------------------------------------------- + /// Creates a new component and transfers ports. Because of the stepwise + /// process in which memory is allocated, ports are transferred, messages + /// are exchanged, component lifecycle methods are called, etc. This + /// function facilitates a lot of implicit assumptions (e.g. when the + /// `Component::on_creation` method is called, the component is already + /// registered at the runtime). fn create_component_and_transfer_ports( &mut self, sched_ctx: &SchedulerCtx, creator_ctx: &mut CompCtx, @@ -709,7 +716,7 @@ impl CompPDL { let (created_key, component) = sched_ctx.runtime.finish_create_pdl_component( reservation, component, created_ctx, false, ); - component.component.on_creation(sched_ctx); + component.component.on_creation(created_key.downgrade(), sched_ctx); // Now modify the creator's ports: remove every transferred port and // potentially remove the peer component.