Open Ved-s opened 5 months ago
hmm. I believe they do lock, as all instances of eprintln!("{}", message)
do. but they then release the lock, and that causes the result you see. it's not clear that we should change the way it currently works by default. I know that rustc did it for its panic infrastructure, but rustc is a very opinionated Rust program.
The panic hook creates a new stderr handle that does not lock
That's probably intentional to not deadlock during error reporting and to get last-gasp errors out as fast as possible. "probably" because I don't know the original motivation, but I think the current behavior is reasonable.
oh, okay! I stand corrected.
the manual-coalescing behavior done there does seem like a slightly better move than going for locking.
Panics don't seem to lock stderr while printing, so if multiple threads panic at once, this will happen:
As you can see, i forgot a
todo!()
in the code and 4 threads executed it at the same timeMeta
rustc --version --verbose
: