bozosujet

This commit is contained in:
Camille Chauvet
2023-05-17 13:28:42 +02:00
parent 8371b01390
commit aefb6ceec0
21 changed files with 0 additions and 0 deletions

33
philo/threads.c Normal file
View File

@ -0,0 +1,33 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* threads.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/04/27 11:33:45 by cchauvet #+# #+# */
/* Updated: 2023/04/27 11:37:40 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
#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);
}