i would like to create multiple threads and launch it at the same time they are created, for the code to goes the fastest possible i tried to do this :
for (i = 1; i < nbClients+1; i++)
{
pthread_create(&tClient, NULL, procedureClient, &i);
pthread_join(tClient, NULL);
free(clients[i].panier); //Libération de la mémoire pour chaque panier
}
if i do pthread_join, the main thread is suspended so it's sequential, so if i do this :
for (i = 1; i < nbClients+1; i++)
{
pthread_create(&tClient, NULL, procedureClient, &i);
free(clients[i].panier); //Libération de la mémoire pour chaque panier
}
is this execution parallel ? is it normal if my printf are in a disorder ? (i think that this is normal but i prefer to ask)
Thanks