#include "philo.h"

void	launch_threads(t_philo *philo, pthread_t *id, int n)
{
	int			i;

	i = 0;
	while (i < n)
	{
		pthread_create(&id[i], NULL, &philo_exec, philo);
		philo = philo->next;
		i++;
	}
}

int	main(int ac, char **av)
{
	pthread_t	*id;
	t_philo		*philo;
	int			i;
	int			n;

	philo = init(ac, av, &id);
	if (philo == NULL)
    	return (0);
	n = philo->params->n_phi;
	launch_threads(philo, id, n);
	i = 0;
	while (i < n)
	{
		pthread_join(id[i], NULL);
		i++;
	}
write(1, "main function\n", 14);
    return (0);
}
