fix(sync/wait_condition): deadlock in WaitCondition::wait
Instead of using a simple switch to determine if preemption is enabled (`is_preemptable: bool`), a counter is used instead. This handles the case where a function holding a `PreemptGuard` calls another function that creates a new `PreemptGuard`. Signed-off-by: Anhad Singh <andypython@protonmail.com>
This commit is contained in:
@@ -165,7 +165,7 @@ pub fn switch(token: &mut CleanLockToken) -> SwitchResult {
|
||||
// We are careful not to lock this context twice
|
||||
let prev_context_guard = unsafe { prev_context_lock.write_arc() };
|
||||
|
||||
if !prev_context_guard.is_preemptable {
|
||||
if !prev_context_guard.is_preemptable() {
|
||||
return SwitchResult::AllContextsIdle;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user