Skip to content

Commit

Permalink
fix waitgroup example
Browse files Browse the repository at this point in the history
  • Loading branch information
GlenDC committed Sep 29, 2024
1 parent 15309c3 commit 055fe36
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/shutdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ impl ShutdownBuilder<sealed::WithoutSignal> {
pub fn build(self) -> Shutdown {
let (zero_tx, zero_rx) = trigger();

let guard = ShutdownGuard::new(Receiver::pending(), zero_tx, Default::default());
let guard = ShutdownGuard::new(Receiver::closed(), zero_tx, Default::default());

Shutdown {
guard,
Expand Down
7 changes: 7 additions & 0 deletions src/trigger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,13 @@ impl Receiver {
}
}

/// Create a always-closed [`Receiver`].
pub(crate) fn closed() -> Self {
Self {
state: ReceiverState::Closed,
}
}

/// Create a always-pending [`Receiver`].
pub(crate) fn pending() -> Self {
Self {
Expand Down

0 comments on commit 055fe36

Please sign in to comment.