21 lines
350 B
C
21 lines
350 B
C
#include "philo.h"
|
|
#include <pthread.h>
|
|
#include <stdbool.h>
|
|
#include <unistd.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);
|
|
}
|