Utilisation thread c++
tapharule
Messages postés
133
Statut
Membre
-
tapharule Messages postés 133 Statut Membre -
tapharule Messages postés 133 Statut Membre -
Bonjour,
Je suis sous ubuntu (je specifi car l utilisation des threads est differentes sous windows)
voila je demande comment execute un thread en lui specifiant une duree limite en c++.
par exemple j ai cette fonction
pthread_t *thread[5]
void boucleInf()
{
while (1);
}
void utilisationThread(int nbr)
{
// executer la fonction boucleInf() avec une duree d une seconde
QUE DOIJE METTRE ICI ???????????????????????
pthread_create(thread[nb], ???, boucleInf, NULL);
}
int main(int ac, char **av)
{
for (int i = 0; i <10; i++)
{
utilisationThread();
}
return (0);
}
merci
Je suis sous ubuntu (je specifi car l utilisation des threads est differentes sous windows)
voila je demande comment execute un thread en lui specifiant une duree limite en c++.
par exemple j ai cette fonction
pthread_t *thread[5]
void boucleInf()
{
while (1);
}
void utilisationThread(int nbr)
{
// executer la fonction boucleInf() avec une duree d une seconde
QUE DOIJE METTRE ICI ???????????????????????
pthread_create(thread[nb], ???, boucleInf, NULL);
}
int main(int ac, char **av)
{
for (int i = 0; i <10; i++)
{
utilisationThread();
}
return (0);
}
merci