Move non-portable thread check guards to specific platforms that use it.