ta0kira / zeolite

Zeolite is a statically-typed, general-purpose programming language.
Apache License 2.0
18 stars 0 forks source link

Should `FAIL()` traces use a mutex? #183

Closed ta0kira closed 3 years ago

ta0kira commented 3 years ago

If for some reason multiple threads crash at once, the trace output gets jumbled. It might be worth locking a mutex while printing the error message.

I think this might effectively lock out the printing of all but the first error, since the thread will terminate the process immediately after printing the error. Or, the termination could happen while the subsequent threads are in the middle of printing their errors. But, maybe subsequent errors don't need to be printed at all, since they will likely have the same origin. (For example, errors in tests/leak-check, which attempts to force race-conditions.)

ta0kira commented 3 years ago

The mutex will need to be dynamically allocated and stored as a static pointer so that there isn't a race condition during destruction if another thread has a failure.