diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2021-01-01 13:58:10 +0100 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2021-01-01 13:58:10 +0100 |
| commit | 83df2b3a49bd3f627ae304bb1529e27d9b2d988c (patch) | |
| tree | 3e1034909614101ebe27bc22ff4d56cea8d2baf9 /philo_one/src/philo_one.h | |
| parent | 632b7d81d6c7943e5e39812068c77df4681ebed2 (diff) | |
| download | philosophers-83df2b3a49bd3f627ae304bb1529e27d9b2d988c.tar.gz philosophers-83df2b3a49bd3f627ae304bb1529e27d9b2d988c.tar.bz2 philosophers-83df2b3a49bd3f627ae304bb1529e27d9b2d988c.zip | |
Fixing philo_one segfault because not checking correctly if finished
Diffstat (limited to 'philo_one/src/philo_one.h')
| -rw-r--r-- | philo_one/src/philo_one.h | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/philo_one/src/philo_one.h b/philo_one/src/philo_one.h index 341c1a8..b566f80 100644 --- a/philo_one/src/philo_one.h +++ b/philo_one/src/philo_one.h @@ -6,13 +6,14 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/11/24 06:11:16 by cacharle #+# #+# */ -/* Updated: 2020/12/30 13:44:14 by charles ### ########.fr */ +/* Updated: 2021/01/01 13:51:29 by charles ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef PHILO_ONE_H # define PHILO_ONE_H +# define _XOPEN_SOURCE 500 # include <unistd.h> # include <sys/time.h> # include <stdlib.h> @@ -42,7 +43,7 @@ typedef struct typedef struct s_philo { - int id; + long int id; pthread_t thread; t_time time_last_eat; t_philo_conf *conf; @@ -55,22 +56,23 @@ typedef struct s_philo ** forks.c */ -pthread_mutex_t *forks_new(int num); -void forks_destroy(pthread_mutex_t *forks, int num); +pthread_mutex_t *forks_new(long int num); +void forks_destroy(pthread_mutex_t *forks, long int num); /* ** philo.c */ t_philo *philos_new(t_philo_conf *conf, pthread_mutex_t *forks); -void philos_destroy(t_philo *philos, int num); -bool philos_start(t_philo *philos, int num); -void philos_detach(t_philo *philos, int num); +void philos_destroy(t_philo *philos, long int num); +bool philos_start(t_philo *philos, long int num); +void philos_detach(t_philo *philos, long int num); /* ** routine.c */ +bool philo_finished(t_philo_conf *conf); void *routine_philo(t_philo *arg); void *routine_death(t_philo *arg); |
