From 6a1e91750ee43fccb6160af0f44139698c8dfdc3 Mon Sep 17 00:00:00 2001 From: Charles Date: Sat, 15 Feb 2020 00:36:04 +0100 Subject: philo_two working (again with the hack?) --- philo_one/fork.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'philo_one/fork.c') diff --git a/philo_one/fork.c b/philo_one/fork.c index fd7ee90..ed1d642 100644 --- a/philo_one/fork.c +++ b/philo_one/fork.c @@ -6,7 +6,7 @@ /* By: cacharle +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/09 23:46:40 by cacharle #+# #+# */ -/* Updated: 2020/02/14 21:18:02 by cacharle ### ########.fr */ +/* Updated: 2020/02/14 21:31:40 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ @@ -58,3 +58,10 @@ t_routine_arg *forks_dispatch(t_philo *philos, t_fork *forks, t_philo_args *args } return (routine_args); } + +void fork_switch(t_fork *fork) +{ + pthread_mutex_lock(&fork->mutex); + fork->used = !fork->used; + pthread_mutex_unlock(&fork->mutex); +} -- cgit