-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fn: rework the ContextGuard and add tests
In this commit, the ContextGuard struct is re-worked such that the context that its new main WithCtx method provides is cancelled in sync with a parent context being cancelled or with it's quit channel being cancelled. Tests are added to assert the behaviour. In order for the close of the quit channel to be consistent with the cancelling of the derived context, the quit channel _must_ be contained internal to the ContextGuard so that callers are only able to close the channel via the exposed Quit method which will then take care to first cancel any derived context that depend on the quit channel before returning.
- Loading branch information
1 parent
d6eeaec
commit 1fe1087
Showing
2 changed files
with
623 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.