diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2021-01-14 10:57:02 +0100 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2021-01-14 10:57:02 +0100 |
| commit | 0ed344821bc3c872100a18289d0384d51af7e970 (patch) | |
| tree | 8b246d0494eff661bc044aa9b8cc38bf37084efc /philo_one/src/main.c | |
| parent | 051e5fa4382a629b76f32e46d3e766ed2eb306fc (diff) | |
| download | philosophers-0ed344821bc3c872100a18289d0384d51af7e970.tar.gz philosophers-0ed344821bc3c872100a18289d0384d51af7e970.tar.bz2 philosophers-0ed344821bc3c872100a18289d0384d51af7e970.zip | |
Diffstat (limited to 'philo_one/src/main.c')
| -rw-r--r-- | philo_one/src/main.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/philo_one/src/main.c b/philo_one/src/main.c index 9ac4cfc..e2dabbc 100644 --- a/philo_one/src/main.c +++ b/philo_one/src/main.c @@ -6,7 +6,7 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/11/24 05:53:02 by cacharle #+# #+# */ -/* Updated: 2021/01/10 11:51:10 by cacharle ### ########.fr */ +/* Updated: 2021/01/12 12:53:27 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ @@ -44,16 +44,16 @@ static int st_setup( { pthread_t thread_flush; - if (pthread_create(&thread_flush, NULL, - (t_routine)st_routine_flush, (void*)&conf) != 0) - return (1); - pthread_detach(thread_flush); if ((conf->forks = forks_new(conf->philo_num)) == NULL) return (1); if ((*philos = philos_new(conf)) == NULL) return (st_destroy(conf, NULL, NULL, NULL)); if (pthread_mutex_init(&conf->mutex_stdout, NULL) != 0) return (st_destroy(conf, *philos, NULL, NULL)); + if (pthread_create(&thread_flush, NULL, + (t_routine)st_routine_flush, (void*)&conf) != 0) + return (st_destroy(conf, *philos, &conf->mutex_stdout, NULL)); + pthread_detach(thread_flush); if (pthread_mutex_init(&conf->mutex_meal_num_finished_counter, NULL) != 0) return (st_destroy(conf, *philos, &conf->mutex_stdout, NULL)); conf->all_alive = true; |
