diff options
| author | Charles <sircharlesaze@gmail.com> | 2020-04-22 13:43:00 +0200 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2020-04-22 13:43:00 +0200 |
| commit | 3c2c3a07396c001f51eac8d0fd0fc84e83eb127b (patch) | |
| tree | 7c646f128d97784fba9fd76cf8bb758a9b965c76 /philo_one/philo.c | |
| parent | 2c5abe421b7a1b92081e38f6b1f04d407fcba834 (diff) | |
| download | philosophers-3c2c3a07396c001f51eac8d0fd0fc84e83eb127b.tar.gz philosophers-3c2c3a07396c001f51eac8d0fd0fc84e83eb127b.tar.bz2 philosophers-3c2c3a07396c001f51eac8d0fd0fc84e83eb127b.zip | |
philo_one refactoring without common lib
Diffstat (limited to 'philo_one/philo.c')
| -rw-r--r-- | philo_one/philo.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/philo_one/philo.c b/philo_one/philo.c index fffbc6c..97a0616 100644 --- a/philo_one/philo.c +++ b/philo_one/philo.c @@ -25,7 +25,7 @@ t_philo *philos_new(int num) while (++i < num) { philos[i].id = i + 1; - philos[i].alive = FALSE; + philos[i].alive = false; } return (philos); } @@ -38,19 +38,19 @@ void philos_destroy(t_philo *philos, int num) free(philos); } -t_bool philos_start(t_philo *philos, t_routine_arg *routine_args, int num) +bool philos_start(t_philo *philos, t_routine_arg *routine_args, int num) { int i; i = -1; while (++i < num) { - philos[i].alive = TRUE; + philos[i].alive = true; if (pthread_create(&philos[i].thread, NULL, &routine_philo, (void*)(routine_args + i)) == -1) - return (FALSE); + return (false); } - return (TRUE); + return (true); } void philos_join(t_philo *philos, int num) @@ -62,13 +62,13 @@ void philos_join(t_philo *philos, int num) { if (philos[i].alive) { - philos[i].alive = FALSE; + philos[i].alive = false; pthread_join(philos[i].thread, NULL); } } } -t_bool philos_starved(t_philo *philos, int num) +bool philos_starved(t_philo *philos, int num) { int i; @@ -79,9 +79,9 @@ t_bool philos_starved(t_philo *philos, int num) { i = -1; while (++i < num) - philos[i].alive = FALSE; - return (TRUE); + philos[i].alive = false; + return (true); } } - return (FALSE); + return (false); } |
