#include #include #include int main(int argc, const char *argv[]) { int sum = 0; // The line below is just shorthand for a // loop directive inside a parallel block #pragma omp parallel for num_threads(2) for (int i = 0; i < 10000; i++) { // TODO: prevent this from causing race conditions // use a critical section sum++; } printf("sum: %d\n", sum); return 0; }