diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2020-09-29 14:56:27 +0200 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2020-09-29 14:56:27 +0200 |
| commit | 6bfcd3c6f921e7717e61167b291bb27bd3f66386 (patch) | |
| tree | 67b2aa4b8a036cb355f90b1f94438b7eb46441f1 /philo_one/main.c | |
| parent | ac4278405b7a258010219499cccc0dd978201caf (diff) | |
| download | philosophers-6bfcd3c6f921e7717e61167b291bb27bd3f66386.tar.gz philosophers-6bfcd3c6f921e7717e61167b291bb27bd3f66386.tar.bz2 philosophers-6bfcd3c6f921e7717e61167b291bb27bd3f66386.zip | |
Fixing taking none existing fork in logs
Diffstat (limited to 'philo_one/main.c')
| -rw-r--r-- | philo_one/main.c | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/philo_one/main.c b/philo_one/main.c deleted file mode 100644 index 83b5564..0000000 --- a/philo_one/main.c +++ /dev/null @@ -1,46 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* main.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2019/11/24 05:53:02 by cacharle #+# #+# */ -/* Updated: 2020/09/28 14:59:59 by cacharle ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "philo_one.h" - -int main(int argc, char **argv) -{ - t_philo_conf philo_args; - t_philo *philos; - pthread_mutex_t *forks; - t_routine_arg *routine_args; - - if (!parse_args(&philo_args, argc, argv)) - return (1); - if (philo_args.philo_num < 2) - return (h_err(1, "Error: there should be at least 2 philosophers")); - if ((forks = forks_new(philo_args.philo_num)) == NULL) - return (1); - if ((philos = philos_new(philo_args.philo_num)) == NULL) - return (1); - if ((routine_args = forks_dispatch(philos, forks, &philo_args)) == NULL) - return (1); - philo_args.all_alive = true; - pthread_mutex_init(&philo_args.mutex_all_alive, NULL); - pthread_mutex_init(&philo_args.mutex_stdout, NULL); - if (!philos_start(philos, routine_args, philo_args.philo_num)) - return (1); - while (philo_args.all_alive) - ; - philos_join(philos, philo_args.philo_num); - pthread_mutex_destroy(&philo_args.mutex_stdout); - pthread_mutex_destroy(&philo_args.mutex_all_alive); - free(routine_args); - free(philos); - forks_destroy(forks, philo_args.philo_num); - return (0); -} |
