#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <omp.h>

void generate()
{
  char message[]="so far so good!";
  
  for(int i = 0; i < 10 ; i++)
#pragma omp task shared(message) firstprivate(i)
    printf("task %d by thread %d >>>> %s <<<< \n",
	   i,omp_get_thread_num(), message);
  
#pragma omp taskwait
}


int main()
{
  
#pragma omp parallel
  {
#pragma omp single
    {
      generate();
      printf("%d - after generate\n", omp_get_thread_num());
    }
  }
  return 0;
}
  
