-
Notifications
You must be signed in to change notification settings - Fork 480
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
adjustments to core suspender #5075
base: develop
Are you sure you want to change the base?
Conversation
with the last commit this now does resolve #5074 i've validated it on windows but needs testing on linux test procedure:
|
@dhthwy has confirmed that this works on linux, so i'm releasing it for review |
thanks again to @NicksWorld for their invaluable help on this PR |
to reduce danger of deadlocking will be reverted in DFHack#5075
this is an attempted step to improve semantics around core suspenders. this does not actually resolve DFHack#5074 but it is intended as a step toward doing so
this switches the core lock to a recursive timed mutex, uses a `try_lock_for` in `CoreSuspenderBase` and changes `help_helper` and `get_commands` over to using conditional locks to avoid a hang in the event that a core lock cannot be acquired in these methods i also moved some repeated code into protected/private methods in both `CoreSuspenderBase` and `CoreSuspender` to mitigate DRY, which also massively improves readability h/t to @NicksWorld for their help in figuring out the required semantics Co-Authored-By: Nicholas McDaniel <[email protected]>
Drastically simplify CoreSuspender API: * remove access to state manipulation * add ConditionalCoreSuspender subclass for conditional locks * fix various errors around use of an explicit core argument when creating a CoreSuspender
to satisfy gcc's order warning i will shortly submit a PR to add `/w15038` to the msvc configuration so msvc will also catch these warnings going forward
The last batch of changes drastically simplify the |
removed the local `isLocked` member from `CoreSuspenderBase` as it is redundant with `owns_lock()` from `std::unique_lock` h/t to @NicksWorld for pointing this out Co-Authored-By: Nicholas McDaniel <[email protected]>
no point in calling `owns_lock` twice
I'm not certain of the full effect of this change, but the changes look reasonable to merge for practical testing |
this is an attempted step to improve semantics around core suspenders. this does not actually resolve #5074 but it is intended as a step toward doing so