UNB/ CS/ David Bremner/ teaching/ cs3383/ examples/ argstest.cc
#include <iostream>
#include <cilk/cilk.h>
#include <cilk/cilk_api.h>
#include <unistd.h>

using namespace std;

int foo(int x, long delay) {
  usleep(delay);  
  return x+1;
}

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

  int x = 0;
  int y = 0;

  long delay = 0;
  
  if (argc>1)
    delay = atol (argv[1]);

  x = cilk_spawn foo (x, delay);
  y = foo (x, delay);
  cilk_sync;

  cout << x << " " << y << endl;
}