diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2021-01-10 10:54:04 +0100 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2021-01-10 10:54:04 +0100 |
| commit | eb2cfb574efafcf2c3c6200d1cd2de700ec8ddfb (patch) | |
| tree | efff80bbbc2157979eaae006f6835d020062dba9 /philo_one/src/philo.c | |
| parent | 802ea8347d1ceb7a02cf279359b3b101106fab94 (diff) | |
| download | philosophers-eb2cfb574efafcf2c3c6200d1cd2de700ec8ddfb.tar.gz philosophers-eb2cfb574efafcf2c3c6200d1cd2de700ec8ddfb.tar.bz2 philosophers-eb2cfb574efafcf2c3c6200d1cd2de700ec8ddfb.zip | |
Fixing bad performance at school by adding more delay to the death checking loop, Added mutex/semaphore to protect against eating and dying at the same time
Diffstat (limited to 'philo_one/src/philo.c')
| -rw-r--r-- | philo_one/src/philo.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/philo_one/src/philo.c b/philo_one/src/philo.c index 911f6b9..8a41fe7 100644 --- a/philo_one/src/philo.c +++ b/philo_one/src/philo.c @@ -6,7 +6,7 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/09 23:47:14 by cacharle #+# #+# */ -/* Updated: 2021/01/09 14:39:03 by charles ### ########.fr */ +/* Updated: 2021/01/10 09:49:48 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ @@ -30,6 +30,7 @@ t_philo *philos_new(t_philo_conf *conf, pthread_mutex_t *forks) philos[i].fork_right = forks + (i + 1) % conf->philo_num; pthread_mutex_init(&philos[i].mutex_start, NULL); pthread_mutex_lock(&philos[i].mutex_start); + pthread_mutex_init(&philos[i].mutex_eat, NULL); } return (philos); } |
