From d87415c6ea52105739d5cc05eff9442b09178470 2022-02-02 17:34:36 From: mh Date: 2022-02-02 17:34:36 Subject: [PATCH] WIP: Fix bugs during multithreading as well --- diff --git a/src/runtime2/component/component_pdl.rs b/src/runtime2/component/component_pdl.rs index f42259ea5a5a711d30d44cd09e1f4ab459aba2c8..fb391058dfb1bdfad2b058ca73c5eaec63cfe33e 100644 --- a/src/runtime2/component/component_pdl.rs +++ b/src/runtime2/component/component_pdl.rs @@ -312,8 +312,7 @@ impl CompPDL { /// the internal `Mode`, such that the next call to `run` can take the /// appropriate next steps. fn handle_sync_decision(&mut self, sched_ctx: &SchedulerCtx, comp_ctx: &mut CompCtx, decision: SyncRoundDecision) { - debug_assert_eq!(self.mode, Mode::SyncEnd); - sched_ctx.log(&format!("Handling sync decision: {:?}", decision)); + sched_ctx.log(&format!("Handling sync decision: {:?} (in mode {:?})", decision, self.mode)); let is_success = match decision { SyncRoundDecision::None => { // No decision yet @@ -324,6 +323,7 @@ impl CompPDL { }; // If here then we've reached a decision + debug_assert_eq!(self.mode, Mode::SyncEnd); if is_success { self.mode = Mode::NonSync; self.consensus.notify_sync_decision(decision); @@ -531,7 +531,6 @@ impl CompPDL { fn handle_incoming_sync_message(&mut self, sched_ctx: &SchedulerCtx, comp_ctx: &mut CompCtx, message: SyncMessage) { let decision = self.consensus.receive_sync_message(sched_ctx, comp_ctx, message); - debug_assert!(self.mode == Mode::Sync || self.mode == Mode::SyncEnd); self.handle_sync_decision(sched_ctx, comp_ctx, decision); } diff --git a/src/runtime2/tests/mod.rs b/src/runtime2/tests/mod.rs index 365aaf681f9f85c26a180f637ecfca2827dfbebd..7bdc1ce2771d8f70da978ac0ad6a834e5a414e6b 100644 --- a/src/runtime2/tests/mod.rs +++ b/src/runtime2/tests/mod.rs @@ -80,6 +80,6 @@ fn test_component_communication() { new sender(o_mrmm, 5, 5); new receiver(i_mrmm, 5, 5); }").expect("compilation"); - let rt = Runtime::new(1, pd); + let rt = Runtime::new(3, pd); create_component(&rt, "", "constructor", no_args()); } \ No newline at end of file