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
use crossbeam_utils::thread;fnmain(){
thread::scope(|s| {
s.spawn(|_| {panic!("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");});
s.spawn(|_| {panic!("BBBBBBBBBBBBBBBBBBBBBBBBBBBBB");});});}
When running it will interleave the panic messages written to stderr:
thread 'thread '<unnamed><unnamed>' panicked at '' panicked at 'BBBBBBBBBBBBBBBBBBBBBBBBBBBBBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', src\main.rs:12:13
or
thread 'thread '<unnamed>' panicked at 'BBBBBBBBBBBBBBBBBBBBBBBBBBBBB', <unnamed>' panicked at 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', src\main.rs:src\main.rs10::6:13
or
thread '<unnamed>' panicked at 'thread '<unnamed>' panicked at 'BBBBBBBBBBBBBBBBBBBBBBBBBBBBB', src\main.rs:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', src\main.rs10::13
This hurts readability. I believe in order to fix this, it would be helpful to preferably suppress the output. Alternatively one could serialize the writes, but given that spawn() provides a Result with the panic, I believe it is best left to the programmer on what to do with the panic.
The text was updated successfully, but these errors were encountered:
Consider the following code:
When running it will interleave the panic messages written to stderr:
thread 'thread '<unnamed><unnamed>' panicked at '' panicked at 'BBBBBBBBBBBBBBBBBBBBBBBBBBBBBAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', src\main.rs:12:13
or
thread 'thread '<unnamed>' panicked at 'BBBBBBBBBBBBBBBBBBBBBBBBBBBBB', <unnamed>' panicked at 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', src\main.rs:src\main.rs10::6:13
or
thread '<unnamed>' panicked at 'thread '<unnamed>' panicked at 'BBBBBBBBBBBBBBBBBBBBBBBBBBBBB', src\main.rs:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', src\main.rs10::13
This hurts readability. I believe in order to fix this, it would be helpful to preferably suppress the output. Alternatively one could serialize the writes, but given that
spawn()
provides a Result with the panic, I believe it is best left to the programmer on what to do with the panic.The text was updated successfully, but these errors were encountered: