-
Notifications
You must be signed in to change notification settings - Fork 760
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
Fix deadlock in update_counts #924
Conversation
Looks good, but I feel the combination of |
@kngwyu @davidhewitt I've checked this fix, it works well - thanks. |
I would be happy to use a mutex to reduce amount of |
Changed to remove |
src/gil.rs
Outdated
// Get vec from one of ReferencePool's mutexes via lock, swap vec if needed, unlock. | ||
($cell:expr) => {{ | ||
let mut locked = $cell.lock(); | ||
let mut out = None; |
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 don't think we need Option here, too. Zero-sized Vec is internally a constant and fast.
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.
Yep agreed 👍 if you want to change this before I get a chance later tonight, please push to this branch 😄
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.
Done 👍
Thank you! |
This fixes the deadlock reported in the discussion in #916, which became possible after incomplete test coverage of the change made in #899.
I wrote the test first and so can confirm the deadlock did indeed exist before this bugfix.