forked from scylladb/seastar
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
abort_source: subscription: allow calling on_abort explicitly
Today, when calling `subscribe` after abort has alredy been requested on an `abort_source` we return a default- initialized subscription that signifies that subscription failed. With this change, `subscribe` would return an unlinked subscription, that still holds the required callback. `bool(subscription)` stil elaluates to `false` in the same way, since the subscription is unlinked, but, it supports `on_abort`, that calls the subscribed callback, at a later time, the same way as if abort is requested at a later time. Thise allows the users of this interface to implement a unified abort path that can either be called by the abort_source, if subscribe happened before abort was requested, or called by the user `on_abort` call, if abort weas never requested, or if it was requested before `subscribe` was called. Signed-off-by: Benny Halevy <[email protected]>
- Loading branch information
Showing
2 changed files
with
82 additions
and
6 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
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