Description
The standard library scoped threads do not use the OS facilities for joining threads, but instead they implement join logic with their own synchronization primitives. (This seems to help with cleaning up thread resources ASAP rather than keeping them around until the scope finishes and all threads are joined.)
Unfortunately this can show up in Miri as a thread leak, if a thread gets scheduled away just after the custom join logic is done, and then the main thread finishes.
For now, a possible work-around is to use -Zmiri-ignore-leaks
. But of course it'd be nice to find a better solution. Maybe, after the main thread is done, instead of halting execution immediately we could yield that thread N times (for some suitable N), thus giving other threads a chance to finish?