Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(reaper): avoid deadlocks at startup
Previously the reaper at startup would lock it's own `HWNDS_CACHE` and then try to lock the WM to get its `known_hwnds`. However if there was an event in the meantime, process_event would lock the WM first and then it would try to lock the reaper's `HWNDS_CACHE` to update it. This would deadlock since that would be locked by the reaper waiting for the WM lock to be released. This commit now makes it so we pass the `known_hwnds` to the reaper as an argument at startup and it also rearranges the order of loading the listeners. Now komorebi first loads all the manager-type listeners, and only afterwards does it load the commands and events listeners. After some testing this seems to be the best order that doesn't cause any issues at all! There were some other issues that I've noticed before when starting komorebi while having other 3rd parties trying to subscribe to it (like komorebi-bar and YASB), which would make those subscribers lock the `process_command` thread. This doesn't seem to be happening on my tests anymore with this new order.
- Loading branch information