From upstream bug report:
If a thread in thread_group is this_thread, join_all() throws resource_deadlock_would_occur. This violates the function post-condition: "Every thread in the group has terminated." Because of the above, and because it's impossible to enumerate the threads is a thread_group, it should catch resource_deadlock_would_occur and proceed with the joining loop. (The exception can be re-thrown when the loop ends.)
This is a regression from 1.51.0
Patch from upstream does not apply cleanly to 1.52.0.
Merged long time ago. Closing as OBSOLETE