Skip to content
Snippets Groups Projects
Verified Commit c51aec1a authored by Jeremy Soller's avatar Jeremy Soller
Browse files

Workaround waitpid deadlock by making ptrace state thread local

parent 7a8015eb
No related branches found
No related tags found
No related merge requests found
Pipeline #9830 failed
......@@ -39,10 +39,17 @@ impl State {
}
}
static STATE: Once<State> = Once::new();
#[thread_local]
static mut STATE: Option<State> = None;
pub fn init_state() -> &'static State {
STATE.call_once(|| State::new())
// Safe due to STATE being thread_local
unsafe {
if STATE.is_none() {
STATE = Some(State::new())
}
STATE.as_ref().unwrap()
}
}
pub fn is_traceme(pid: pid_t) -> bool {
File::open(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment