https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128548
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- Glicb's pthread_join is documented to do the check and return EDEADLK, which is probably why libstdc++ assumed that could be relied on. POSIX says it's undefined though.
