Ejemplo n.º 1
0
int main (void)
{
   int i;
   ft_thread_t thread_array[MAX_THREADS];

   in_sched   = ft_scheduler_create();
   out_sched  = ft_scheduler_create();
   
   new_input  = ft_event_create(in_sched);
   new_output = ft_event_create(out_sched);

   ft_thread_create(in_sched, traceinstants, NULL, (void *)50);

   for (i=0; i<MAX_THREADS; i++) {
       thread_array[i] = ft_thread_create(in_sched, process, NULL, (void *) &i);
   }
  
   ft_thread_create(in_sched, produce, NULL, NULL);
   ft_thread_create(out_sched, consume, NULL, NULL);

   ft_scheduler_start(in_sched);
   ft_scheduler_start(out_sched);  

   ft_exit();
   return 0;
}
Ejemplo n.º 2
0
int main (void)
{
  ft_thread_t th1, th2;
  
  sched1 = ft_scheduler_create ();
  sched2 = ft_scheduler_create ();  

  ft_thread_create (sched1,traceInstants,NULL,&i1);
  ft_thread_create (sched2,traceInstants,NULL,&i2); 
  
  th1 = ft_thread_create (sched1,f1,NULL,NULL);
  th2 = ft_thread_create (sched2,f2,NULL,NULL);

  ft_scheduler_start (sched1);
  ft_scheduler_start (sched2);  

  ft_exit ();
  return 0;
}
Ejemplo n.º 3
0
int main(void)
{
  ft_scheduler_t sched = ft_scheduler_create ();

  ft_thread_create (sched,behav,NULL,sched);

  ft_scheduler_start (sched);

  ft_exit ();
  return 0;
}
Ejemplo n.º 4
0
int main ()
{
   sched = ft_scheduler_create ();

   ft_scheduler_start (sched);

   ft_thread_create (sched,creator,NULL,NULL);
   
   ft_exit ();
   
   return 0;
}
Ejemplo n.º 5
0
int main (void)
{
  ft_thread_t ft1;
  ft_scheduler_t sched = ft_scheduler_create ();

  ft1 = ft_thread_create (sched,exiting,NULL,NULL);
  ft_thread_create (sched,await_join,NULL,(void*)ft1);

  ft_scheduler_start (sched);

  ft_exit ();
  return 0;
}
Ejemplo n.º 6
0
int main(void)
{
  ft_scheduler_t sched = ft_scheduler_create();

  ft_thread_create(sched,h,NULL,NULL);
  ft_thread_create(sched,w,NULL,NULL);

  ft_scheduler_start(sched);

  pthread_exit (0);
  //ft_exit();
  return 0;
}
Ejemplo n.º 7
0
int main(void)
{
  ft_scheduler_t sched = NULL;
  
  if (NULL == ft_event_create (sched)){
     fprintf (stdout,"cannot create an event before its scheduler\n");
  }

  sched = ft_scheduler_create ();
  ft_scheduler_start (sched);

  exit (0);
  return 0;
}
Ejemplo n.º 8
0
int main(void)
{
   ft_scheduler_t sched = ft_scheduler_create();
   event1 = ft_event_create (sched);
   event2 = ft_event_create (sched);

   //ft_thread_create (sched,traceInstants,NULL,NULL); 
   ft_thread_create(sched,waiter1,NULL,NULL);
   ft_thread_create(sched,waiter2,NULL,NULL);  

   ft_scheduler_start(sched);

   ft_exit();
   return 0;
}
Ejemplo n.º 9
0
int main (void)
{
  ft_scheduler_t sched = ft_scheduler_create ();

  evt = ft_event_create (sched);

  ft_thread_create (sched,trace_instant,NULL,NULL);

  ft_thread_create (sched,awaiter,NULL,NULL);     

  ft_scheduler_start (sched);

  ft_exit ();
  return 0;
}
Ejemplo n.º 10
0
int main() {
    SDL_Init(SDL_INIT_AUDIO);
    printf("creation du scheduler\n");
    ft_scheduler_t ordo = ft_scheduler_create();

    ft_thread_create(ordo,traceinstants,NULL,(void*) 5000);
    ft_thread_t ui = ft_thread_create(ordo,app_ui,NULL,NULL);
    ft_thread_t sound =  ft_thread_create(ordo,app_sound,NULL,NULL);



    ft_scheduler_start(ordo);
    printf("fin");
    SDL_Quit();
    return EXIT_SUCCESS;
}
Ejemplo n.º 11
0
int main(void)
{
   ft_scheduler_t sched = ft_scheduler_create();
   event = ft_event_create (sched);

   //ft_thread_create (sched,traceInstants,NULL,NULL); 
   ft_thread_create(sched,waiter,NULL,NULL);

   ft_scheduler_start(sched);

   sleep (1);
   ft_scheduler_broadcast (event);

   ft_exit();
   return 0;
}
Ejemplo n.º 12
0
int main (void)
{
  int i;
  ft_scheduler_t sched = ft_scheduler_create ();

  for (i=0;i<EVENT_NUM;i++){
     ft_event_t evt = ft_event_create (sched);
     //fprintf (stdout, "new event %d\n",i);  
     ft_thread_create (sched,waiter,NULL,(void*)evt);     
  }

  ft_thread_create (sched,counter,NULL,NULL);

  ft_scheduler_start (sched);

  ft_exit ();
  return 0;
}
Ejemplo n.º 13
0
int main (void)
{
  pthread_mutex_t mutex;
  pthread_mutex_init (&mutex,NULL);

  sched = ft_scheduler_create ();

  ft0 = ft_thread_create (sched,unlinked,NULL,&mutex);
  ft1 = ft_thread_create (sched,unlinked,NULL,&mutex);
  ft2 = ft_thread_create (sched,unlinked,NULL,&mutex);
  
  ft_thread_create (sched,join_behav,NULL,NULL);

  ft_scheduler_start (sched);

  ft_exit ();
  return 0;
}
Ejemplo n.º 14
0
int main(void)
{
  int v, *cell = &v;
  ft_thread_t th1,th2;
  ft_scheduler_t sched = ft_scheduler_create ();

  th1 = ft_thread_create (sched,pr,NULL,"Hello ");
  th2 = ft_thread_create (sched,pr,NULL,"World!\n");

  ft_scheduler_start(sched);

  pthread_join (ft_pthread (th1),(void**)&cell);
  pthread_join (ft_pthread (th2),(void**)&cell);
  
  fprintf (stdout,"exit\n");
  exit (0);

  return 0;
}
Ejemplo n.º 15
0
int main(void)
{
  int i;
  ft_thread_t ft;
  
  sched = ft_scheduler_create ();
  evt = ft_event_create (sched);

  table = (ft_thread_t*)malloc (max*sizeof (ft_thread_t));
  for (i=0; i<max; i++) {
     table[i] = ft_thread_create(sched,fonc,NULL,NULL);
  }
  ft = ft_thread_create (sched,control,NULL,NULL);
  
  ft_scheduler_start(sched);

  ft_exit();
  return 0;
}
Ejemplo n.º 16
0
int main (void)
{
   int i;
   ft_thread_t thread_array[MAX_THREADS];

   file_sched = ft_scheduler_create ();
   
   new_elem = ft_event_create (file_sched);

   for (i=0; i<MAX_THREADS; i++){
      thread_array[i] = ft_thread_create (file_sched,process,NULL,NULL);
   }
  
   ft_thread_create (file_sched,produce,NULL,NULL);

   ft_scheduler_start (file_sched);

   ft_exit ();
   return 0;
}
Ejemplo n.º 17
0
int main (void)
{
   ft_thread_t self;
   ft_scheduler_t sched;
   ft_thread_t th;

   self = ft_thread_self ();
   if (self == NULL) fprintf (stdout, "bad self 1\n");

   sched = ft_scheduler_create();
   th = ft_thread_create(sched,behav,NULL,NULL);   

   self = ft_thread_self ();
   if (self == NULL) fprintf (stdout, "bad self 2\n");

   ft_scheduler_start (sched);

   self = ft_thread_self ();
   if (self == NULL) fprintf (stdout, "bad self 3\n");

   ft_exit ();
   return 0;
}
Ejemplo n.º 18
0
ft_scheduler_t ft_scheduler_nd_create (void)
{
   ft_scheduler_t sched = ft_scheduler_create ();
   sched->determinist = 0;   
   return sched;   
}