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_two/src/main.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_two/src/main.c')
| -rw-r--r-- | philo_two/src/main.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/philo_two/src/main.c b/philo_two/src/main.c index fb441dc..197ee5c 100644 --- a/philo_two/src/main.c +++ b/philo_two/src/main.c @@ -6,7 +6,7 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/14 22:45:23 by cacharle #+# #+# */ -/* Updated: 2021/01/09 15:35:47 by charles ### ########.fr */ +/* Updated: 2021/01/10 10:18:12 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ @@ -23,12 +23,17 @@ static int st_destroy( t_philo *philos, pthread_t *threads) { + /* long int i; */ + sem_unlink(PHILO_SEM_NAME); sem_unlink(PHILO_SEM_STDOUT_NAME); sem_unlink(PHILO_SEM_FINISH_NAME); sem_unlink(PHILO_SEM_MEAL_NUM_NAME); sem_unlink(PHILO_SEM_START_NAME); sem_unlink(PHILO_SEM_GRAB_NAME); + /* i = -1; */ + /* while (++i < philos[0].conf->philo_num) */ + /* sem_unlink(philo_sem_eat_name(philo[i].id)); */ free(philos); free(threads); return (1); |
