This commit is contained in:
Camille Chauvet
2023-04-13 13:00:39 +00:00
commit a37cbf88f3
20 changed files with 625 additions and 0 deletions

20
threads.c Normal file
View File

@ -0,0 +1,20 @@
#include "philo.h"
#include "struct.h"
#include <pthread.h>
#include <stdbool.h>
#include <stddef.h>
bool threads_init(t_data *data)
{
size_t i;
i = 0;
while (i < data->nb_philos)
{
if (pthread_create(&data->threads[i], NULL, philo_routine, data->philos[i]))
return (true);
pthread_detach(data->threads[i]);
i++;
}
return (false);
}