ykjit / yk

yk packages
https://ykjit.github.io/yk/
Other
29 stars 7 forks source link

Join worker threads and percolate panics outwards. #1346

Closed ltratt closed 2 months ago

ltratt commented 2 months ago

Currently if a worker thread (i.e. a compiler thread) panics, an error is printed to the terminal, but the main process charges on as if nothing happened. This makes it very easy for errors to be missed.

This commit makes MT, when it is closing down, check whether worker threads have panicked or not.

In one way this works fine, but it's also made it clear to me that relying on drop with an Arc is not a great solution here: we clone MT in various cases, so worker threads can stop drop ever being called in certain cases. Fixing that is a job for another day: this commit does work in enough cases already to be useful.