#include "philo.h"

int	create_mutexes(t_rules *rules)
{
	int	i;

	i = 0;
	if (!pthread_mutex_init(&rules->death, NULL))
		return(FAILURE);
	if (!pthread_mutex_init(&rules->print, NULL))
		return(FAILURE);
	rules->forks = malloc(rules->n_philos * sizeof(pthread_mutex_t));
	if	(!rules->forks)
		return(FAILURE);
	while (i < rules->n_philos)
	{
		if (!pthread_mutex_init(&rules->forks[i], NULL))
			return(FAILURE);
	}
}