UNB/ CS/ David Bremner/ teaching/ cs3383/ examples/ for-race.cc
#include <iostream>
#include <cilk/cilk.h>
#include <cilk/cilk_api.h>

using namespace std;

int main(int argc, char** argv){

  long x = 0;

  const char *worker_param = "4";

  if (argc > 1)
    worker_param = argv[1];
  
  if (0!= __cilkrts_set_param("nworkers",worker_param))  {
      printf("Failed to set worker count\n");
      return 1;
    }

  cilk_for (int i=0; i<1000000000; i++){
    x = x + 1;
  }
  cout << x << endl;
}