diff options
| author | Charles <sircharlesaze@gmail.com> | 2020-02-15 00:36:04 +0100 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2020-02-15 00:36:04 +0100 |
| commit | 6a1e91750ee43fccb6160af0f44139698c8dfdc3 (patch) | |
| tree | 70a9bc690134362459c5617b0213e2822d68ed51 /philo_one/fork.c | |
| parent | f6a960c09c9593af72ff6da2c3ed501e01a0f429 (diff) | |
| download | philosophers-6a1e91750ee43fccb6160af0f44139698c8dfdc3.tar.gz philosophers-6a1e91750ee43fccb6160af0f44139698c8dfdc3.tar.bz2 philosophers-6a1e91750ee43fccb6160af0f44139698c8dfdc3.zip | |
philo_two working (again with the hack?)
Diffstat (limited to 'philo_one/fork.c')
| -rw-r--r-- | philo_one/fork.c | 9 |
1 files changed, 8 insertions, 1 deletions
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 <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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); +} |
