-
Notifications
You must be signed in to change notification settings - Fork 112
[runtime] Implement shutdown tracking with signal reference counting #1357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[runtime] Implement shutdown tracking with signal reference counting #1357
Conversation
e798611 to
baacd49
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is VERY close to what I had in mind.
Nice work!
also use commonware_macros::select in both runtimes
|
I think I addressed all review comments now. I updated the PR description to describe the API behavior. |
|
This is VERY close. Do you mind if I take it over to address a few small style things before merging (don't want to annoy you)? |
|
Sure no worries. |
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## main #1357 +/- ##
==========================================
+ Coverage 91.24% 91.26% +0.01%
==========================================
Files 262 263 +1
Lines 65280 65476 +196
==========================================
+ Hits 59565 59755 +190
- Misses 5715 5721 +6
... and 3 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Use reference counting to track the lifecycle of
Signalinstances and coordinate proper shutdown. EachSignalcontains anArc<SignalGuard>that notifies a completion channel when dropped, allowing the runtime to know when all signal references have been released. TheSpawner::stop()method is now async and waits on this completion channel, ensuring that all tasks holdingSignalreferences have completed their cleanup work before shutdown finishes.Shutdown Semantics
stop()call: Initiates shutdown with provided exit valuestop()calls: All wait on the same original completion, but the provided exit value is ignoredstop()returns immediately without waitingstopped()call: Returns aSignalthat resolves to the original exit value. After the firststop()call thisSignalalways resolves immediately.Fixes #1104.