Skip to content

Commit 221e7f8

Browse files
committed
feat(port_std): deny spawn after shutdown as a safe guard
1 parent 9b89da9 commit 221e7f8

File tree

1 file changed

+4
-0
lines changed
  • src/constance_port_std/src

1 file changed

+4
-0
lines changed

src/constance_port_std/src/ums.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ impl<'a, Sched: Scheduler> ThreadGroupLockGuard<'a, Sched> {
138138
/// - [`yield_now`]
139139
///
140140
pub fn spawn(&mut self, f: impl FnOnce(ThreadId) + Send + 'static) -> ThreadId {
141+
if self.guard.shutting_down && self.guard.num_threads == 0 {
142+
panic!("thread group has already been shut down");
143+
}
144+
141145
let state = Arc::clone(self.state_ref);
142146

143147
// Allocate a `ThreadId`

0 commit comments

Comments
 (0)