Last active
May 1, 2022 06:26
-
-
Save haxpor/f593667ad883bc915a581bd95e358ecc to your computer and use it in GitHub Desktop.
attempt to bypass poisoned mutex (not work yet)
This file contains hidden or 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
macro_rules! serial_test { | |
(fn $name: ident() $body: block) => { | |
#[test] | |
fn $name() { | |
let guard = LOCK.try_lock(); | |
if let Ok(mutex) = guard { | |
$body | |
} | |
else { | |
let err = guard.unwrap_err(); | |
if let std::sync::TryLockError::Poisoned(p) = err { | |
let _guard = p.get_ref(); // not hit this at all | |
$body | |
} | |
else { | |
panic!("Error cannot acquire lock"); // always hit this | |
} | |
} | |
}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment