From 6bde847f393c0ce53775306b1f08cc617c4efb2b Mon Sep 17 00:00:00 2001 From: "Ryan D. Friese" Date: Fri, 8 Nov 2024 11:48:39 -0800 Subject: [PATCH] ensure Darc Drops are awaited properly --- src/darc.rs | 4 ++++ src/lamellar_team.rs | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/darc.rs b/src/darc.rs index 6e78190..072592c 100644 --- a/src/darc.rs +++ b/src/darc.rs @@ -1620,6 +1620,8 @@ macro_rules! launch_drop { ); } // team.print_cnt(); + team.team_counters.inc_outstanding(1); + team.world_counters.inc_outstanding(1); //ensure we don't trigger any warnings in wait all let mut am = team.exec_am_local(DroppedWaitAM { inner_addr: $inner_addr as *const u8 as usize, mode_addr: $inner.mode_addr, @@ -1629,6 +1631,8 @@ macro_rules! launch_drop { phantom: PhantomData::, }); am.launch(); + team.team_counters.dec_outstanding(1); + team.world_counters.dec_outstanding(1); }; } diff --git a/src/lamellar_team.rs b/src/lamellar_team.rs index db26b70..456a9d9 100644 --- a/src/lamellar_team.rs +++ b/src/lamellar_team.rs @@ -1424,6 +1424,8 @@ impl LamellarTeamRT { let mut temp_now = Instant::now(); let mut orig_reqs = self.team_counters.send_req_cnt.load(Ordering::SeqCst); let mut orig_launched = self.team_counters.launched_req_cnt.load(Ordering::SeqCst); + let mut world_orig_reqs = self.world_counters.send_req_cnt.load(Ordering::SeqCst); + let mut world_orig_launched = self.world_counters.launched_req_cnt.load(Ordering::SeqCst); // println!( // "in team wait_all mype: {:?} cnt: {:?} {:?}", @@ -1436,10 +1438,15 @@ impl LamellarTeamRT { || orig_reqs != self.team_counters.send_req_cnt.load(Ordering::SeqCst) || orig_launched != self.team_counters.launched_req_cnt.load(Ordering::SeqCst)) || (self.parent.is_none() - && self.world_counters.outstanding_reqs.load(Ordering::SeqCst) > 0)) + && (self.world_counters.outstanding_reqs.load(Ordering::SeqCst) > 0 + || world_orig_reqs != self.world_counters.send_req_cnt.load(Ordering::SeqCst) + || world_orig_launched != self.world_counters.launched_req_cnt.load(Ordering::SeqCst)) + )) { orig_reqs = self.team_counters.send_req_cnt.load(Ordering::SeqCst); orig_launched = self.team_counters.launched_req_cnt.load(Ordering::SeqCst); + world_orig_reqs = self.world_counters.send_req_cnt.load(Ordering::SeqCst); + world_orig_launched = self.world_counters.launched_req_cnt.load(Ordering::SeqCst); // std::thread::yield_now(); // self.flush(); if std::thread::current().id() != *crate::MAIN_THREAD {