#include "philo.h"

int	create_threads(t_rules *rules)
{
	int		i;
	t_philo	*philo;

	i = 0;
	while (i < rules->n_philos)
	{
		philo = &rules->philos[i];
		philo->pid = malloc(sizeof(pthread_t));
		if (!philo->pid)
			return (FAILURE);
		if (pthread_create(philo->pid, NULL, &philo_routine, philo))
			return (FAILURE);
		i++;
	}
	return (SUCCESS);
}