Exemple #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;
}
Exemple #2
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;
}
Exemple #3
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;
}
Exemple #4
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;
}
Exemple #5
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;
}
Exemple #6
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;
}
Exemple #7
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;
}
Exemple #8
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;
}
Exemple #9
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;
}
Exemple #10
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;
}
Exemple #11
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;
}
Exemple #12
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;
}
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;
}
Exemple #14
0
int main ()
{
   sched = ft_scheduler_create ();

   ft_scheduler_start (sched);

   ft_thread_create (sched,creator,NULL,NULL);
   
   ft_exit ();
   
   return 0;
}
Exemple #15
0
void behav (void *args)
{
   if (i > 0){
      ft_scheduler_t s = (ft_scheduler_t) args;
      i--;
      ft_thread_create (s,behav,NULL,s);
      fprintf (stdout,"new thread %d!\n",i);
   }else{
      fprintf (stdout,"no more thread!\n");
      fflush (stdout);
      exit(0);
   }
}
Exemple #16
0
void creator (void *args)
{
   int i;
   for (i=0;i<5000;i++) {
      th = ft_thread_create (sched,func,NULL,(void*)i);
      pthread_detach (ft_pthread (th));
      ft_thread_cooperate_n (100);

      ft_thread_join (th);
   }
   fprintf (stdout, "\nexit\n");
   exit (0);
}
Exemple #17
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;
}
// ---------------------------------------------------------------------------
// SimulatorCL::SimulatorCL
// ---------------------------------------------------------------------------
SimulatorCL::SimulatorCL() : 
    RobotBase("Simulator", CLASS_SIMULATOR), 
    server_(NULL), bridge_(BRIDGE_POS_BORDURE), 
    supportPosition1_(450, 450), 
    supportPosition2_(750, 1050), 
    supportPosition3_(1050, 750), 
    supportConfigId_(0), simulationSpeed_(1)
{
    for(unsigned int i=0;i!=BALLE_GRS_NBR;i++) {
      sgBalls_[i] = new SimulatorGrsBall();
      sgBalls_[i]->set(&gBalls_[i]);
    }
    for(unsigned int i=0;i!=QUILLE_NBR;i++) {
      sskittles_[i] = new SimulatorSkittle();
      sskittles_[i]->set(&skittles_[i]);
    }
    setBridgeBorder();
    setWallBorder();
    changeSupport();
    server_ = new SimulatorServer();
    if (server_) server_->startReceiver();
    Viewer3D->createWindows(true, true);
    Viewer3D->enableDisplayEstimatedPos(true);
    registerViewerBtnCB();
    reset(); 
    
    gettimeofday(&chronometerTic, NULL);
    // Start thread simulatorThread() 
#ifdef USE_FTHREAD
    threadUpdatePos = ft_thread_create(ftThread::getScheduler(),
				       simulatorThread,
				       NULL, // cleanup
				       NULL);// parameters
#else
    MTHREAD_CREATE("Main simulator thread",
		   &threadUpdatePos,
		   NULL,
		   simulatorThread, 
		   NULL);
#endif
    LOG_OK("SimulatorCL started\n");

    RobotTimerCL::tic(&simultatorTime);
}
Exemple #19
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;
}