Skip to content

feat: Add ShutdownWatch handle#113

Merged
tisonkun merged 1 commit into
mainfrom
codex/shutdown-watch
May 28, 2026
Merged

feat: Add ShutdownWatch handle#113
tisonkun merged 1 commit into
mainfrom
codex/shutdown-watch

Conversation

@tisonkun

Copy link
Copy Markdown
Collaborator

Summary

This proposes a ShutdownWatch handle created from ShutdownRecv::watch().

ShutdownWatch observes the shutdown latch without holding the wait group, so cloning or storing it does not delay ShutdownSend::await_shutdown.

API shape

impl ShutdownRecv {
    pub fn watch(&self) -> ShutdownWatch;
}

#[derive(Debug, Clone)]
pub struct ShutdownWatch;

ShutdownWatch mirrors the observation APIs on ShutdownRecv:

  • is_shutdown_now
  • is_shutdown
  • is_shutdown_owned

The naming is intended to stay closer to the existing short role names (ShutdownSend / ShutdownRecv) than Observer, while avoiding the misleading Rust Weak association.

Closes #112.

Verification

  • cargo x test
  • cargo +nightly x lint

@tisonkun tisonkun changed the title Add shutdown watch handle feat: Add ShutdownWatch handle May 28, 2026
@tisonkun tisonkun merged commit 1781513 into main May 28, 2026
9 checks passed
@tisonkun tisonkun deleted the codex/shutdown-watch branch May 28, 2026 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ShutdownRecv should be able to create weak clone

1 participant