Topic/fix solaris threads

This is the github version of TRAC 4911 https://svn.open-mpi.org/trac/ompi/ticket/4911

This is a backport of r32792 / b1c4daa9567c7647318b9b673698c2251264f22e for the v1.8 branch

@jsquyres , please review this PR. Thanks