1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
pthread_mutex_t mutex_cycab = PTHREAD_MUTEX_INITIALIZER;
static void *gestion_cycab1 (void *p_data)
{
bool loopcycab1 = true;
do
{
pthread_mutex_lock(&mutex_cycab);
bayoccfil.Bof_display_cycab1(false);
if (rrt.Predict_Path('1', step) == false) loopcycab1 = false;
rrt.Move_Cycab ('1', step);
hugrcommunication.get_Cycab_PosY('1'),2);
pthread_mutex_unlock(&mutex_cycab);
bayoccfil.raz_vec_occ_grid_point();
}
while (loopcycab1 == true);
return NULL;
}
static void *gestion_cycab2 (void *p_data)
{
bool loopcycab2 = true;
do
{
pthread_mutex_lock(&mutex_cycab);
cout<<"traitement thread 2"<<endl;
pthread_mutex_unlock(&mutex_cycab);
}
while (loopcycab2 == true);
return NULL;
}
int main()
{
bayoccfil.initialisation();
pthread_t thread_cycab1;
pthread_t thread_cycab2;
pthread_create (&thread_cycab1, NULL, gestion_cycab1, NULL);
pthread_create (&thread_cycab2, NULL, gestion_cycab2, NULL);
#if 1
pthread_join (thread_cycab1, NULL);
pthread_join (thread_cycab2, NULL);
#endif
return 0;
} |
Partager