// $Id: main.c 138 2010-05-12 17:34:01Z rosiere $

//=====[ main ]=================================================================
/*
 * All thread execute this routine
 * Initialize the thread and attribute a Workload at each thread
 */

#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>

#include "workload.h"

int main()
{
#ifdef MORPHEO
  int pid = (int)getpid();
  
  printf("Start process %d\n",pid);
  
  if ((pid < NB_THREAD_MAX) && 
      (pid < (int)NB_WORKLOAD))
    (*WorkLoad[pid])();
  else
    printf("The number of function in the workload is %d. (maximum of thread is : %d)\n",(int)NB_WORKLOAD,NB_THREAD_MAX);
#endif

#ifdef UNIX
  for (int i=0; i<(int)NB_WORKLOAD; ++i)
    (*WorkLoad[i])();
#endif
    
  exit (0);

  while (1);
}
