You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let r = WaitForSingleObjectEx(lock,INFINITE,FALSE);
debug_assert_eq!(r,0);
let ret = Init{ lock };
// Ok, phew! Now that we're all safely synchronized, let's actually
// start processing everything. First up we need to ensure that
// `dbghelp.dll` is actually loaded in this process. We do this
// dynamically to avoid a static dependency. This has historically been
// done to work around weird linking issues and is intended at making
// binaries a bit more portable since this is largely just a debugging
// utility.
//
// Once we've opened `dbghelp.dll` we need to call some initialization
// functions in it, and that's detailed more below. We only do this
// once, though, so we've got a global boolean indicating whether we're
// done yet or not.
DBGHELP.ensure_open()?;
staticmutINITIALIZED:bool = false;
if !INITIALIZED{
set_optional_options();
INITIALIZED = true;
}
Ok(ret)
}
}
so i think it is not necessary for callers to have their own mutex? i do see that the gimli symbolification is unsafe because it accesses MAPPINGS_CACHE unsynchronized, but maybe we can use a similar trick there? or just use std::lazy or something?
i found this comment in libstd: https://github.com/rust-lang/rust/blob/59a4f02f836f74c4cf08f47d76c9f6069a2f8276/library/std/src/sys/backtrace.rs#L20-L48
and indeed dbghelp does not appear to be threadsafe. but backtrace-rs already has a mutex around dbghelp:
backtrace-rs/src/dbghelp.rs
Lines 283 to 385 in 72265be
so i think it is not necessary for callers to have their own mutex? i do see that the gimli symbolification is unsafe because it accesses
MAPPINGS_CACHE
unsynchronized, but maybe we can use a similar trick there? or just usestd::lazy
or something?backtrace-rs/src/symbolize/gimli.rs
Lines 325 to 339 in dcd0aaa
see around rust-lang/rust#127397 (comment) for previous discussion; cc @ChrisDenton @workingjubilee
The text was updated successfully, but these errors were encountered: