there are no threads here as there is no parallel section. Maybe you meant omp parallel for ?

On that point, it is in general safer (if the code changes down the line) to introduce threads via a parallel section spanning the function. That way, all the variables declared are thread-local by scope (see some of the other OpenMP code for examples) and no private(..) shared(...) statements are required. In the case of just one for loop the type of construct used here is sometimes faster, but I've found my approach to be faster in almost all cases. (because it's more symmetric)