-
-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(wm): prevent hidden_hwnds deadlock
I used a parking_lot to detect what I suspected to be the deadlock resulting in issue #13. I was pleasantly surprised by the alternative to std::sync::Mutex provided by parking_lot, especially not having to unlock it to use it, and of course the excellent and intuitive (even if experimental) deadlock detector. I have decided to use parking_lot::Mutex as an almost-drop-in replacement for std::sync::Mutex, as I expect that this isn't the last time komorebi will have a deadlocking issue, and I have put the deadlock detection code which runs in a separate thread behind a "deadlock_detection" feature. The actual deadlock itself was solved by scoping the first lock in the handler for WindowManagerEvent::Hide and then executing any required operations (some of which, like window.maximize(), may require another lock on HIDDEN_HWNDS) in a separate scope once the previous lock has been dropped. In the future I should look at integrating globals like HIDDEN_HWNDS into WindowManager in a way that won't lead to double-mutable-borrow issues. fix #13
- Loading branch information
Showing
10 changed files
with
201 additions
and
48 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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.