* commit '5b907be8f5c387e7580a8e43935250adabc408c8': Move the main thread check to the appropriate place.