Update thread manager from Anaconda upstream version

Mainly to get the atomic behavior fixes but the error
handling improvements also can't hurt. :)