Fix thread preprocessor directives