/* ************************************************************************** */1/* */2/* ::: :::::::: */3/* ft_start_mutex.c :+: :+: :+: */4/* +:+ +:+ +:+ */5/* By: yabtaour <[email protected]> +#+ +:+ +#+ */6/* +#+#+#+#+#+ +#+ */7/* Created: 2022/05/19 22:14:47 by yabtaour #+# #+# */8/* Updated: 2022/05/19 22:14:49 by yabtaour ### ########.fr */9/* */10/* ************************************************************************** */11#include "philosophers.h"1213int ft_start_mutex(t_data *data)14{15int i;1617i = 0;18while (i < data->philos_num)19{20if (pthread_mutex_init(&data->fork[i], NULL) != 0)21{22free(data);23return (0);24}25i++;26}27if (pthread_mutex_init(&data->output, NULL) != 0)28{29free(data);30return (0);31}32if (pthread_mutex_init(&data->eat, NULL) != 0)33{34free(data);35return (0);36}37return (1);38}394041