-
Notifications
You must be signed in to change notification settings - Fork 173
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
feat: add unstable background method to subscriber/queryable/matching listeners #1106
Conversation
This flag was just used to prevent double close/undeclaration, i.e. object being drop after `close`/`undeclare`. Using `ManuallyDrop` instead in `close`/`undeclare` solve this issue, and save some space in structs (often one word counting the padding, which is not negligible).
…ng listeners The only real change of this PR is to undeclare objects at session closing/publisher undeclaration. Calling `background` is then only a `mem::forget`.
@OlivierHecart you might be interested |
@Mallets I've integrated our discussion (see the comments) and fixed my stupid mistakes. I've also renamed all the |
#[inline] | ||
pub fn set_allowed_destination(&mut self, destination: Locality) { |
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.
what happened with set_allowed_destination
? Is it's removal planned?
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.
I discussed about it with @OlivierHecart weeks ago, this thing is currently broken (the modification is not transmitted to the PublisherState
stored in session, only the creation destination matter).
There was maybe another reason, but I forgot. @OlivierHecart do you remember?
@@ -350,6 +358,13 @@ impl<'a> Publisher<'a> { | |||
pub fn undeclare(self) -> impl Resolve<ZResult<()>> + 'a { | |||
Undeclarable::undeclare_inner(self, ()) | |||
} | |||
|
|||
fn undeclare_matching_listeners(&self) -> ZResult<()> { | |||
for id in zlock!(self.matching_listeners).drain() { |
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 code would be safer w.r.t. mutex deadlock if:
- it takes the lock
- it drains the iterator in a supporting vec
- it releases the lock
- it undeclares the matching listeners
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.
Following #1012, but completely reworked (no more builder method), hence a new PR.
Based on #1104, should wait to have it merge before merging this PR.