aboutsummaryrefslogtreecommitdiff
path: root/philo_one/src/philo.c
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2021-01-01 13:58:10 +0100
committerCharles Cabergs <me@cacharle.xyz>2021-01-01 13:58:10 +0100
commit83df2b3a49bd3f627ae304bb1529e27d9b2d988c (patch)
tree3e1034909614101ebe27bc22ff4d56cea8d2baf9 /philo_one/src/philo.c
parent632b7d81d6c7943e5e39812068c77df4681ebed2 (diff)
downloadphilosophers-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.c')
-rw-r--r--philo_one/src/philo.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/philo_one/src/philo.c b/philo_one/src/philo.c
index 3e3d90f..1ffb15b 100644
--- a/philo_one/src/philo.c
+++ b/philo_one/src/philo.c
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/09 23:47:14 by cacharle #+# #+# */
-/* Updated: 2020/12/30 11:58:51 by charles ### ########.fr */
+/* Updated: 2021/01/01 13:33:47 by charles ### ########.fr */
/* */
/* ************************************************************************** */
@@ -14,8 +14,8 @@
t_philo *philos_new(t_philo_conf *conf, pthread_mutex_t *forks)
{
- int i;
- t_philo *philos;
+ long int i;
+ t_philo *philos;
if (conf->philo_num < 0)
return (NULL);
@@ -32,9 +32,9 @@ t_philo *philos_new(t_philo_conf *conf, pthread_mutex_t *forks)
return (philos);
}
-bool philos_start(t_philo *philos, int num)
+bool philos_start(t_philo *philos, long int num)
{
- int i;
+ long int i;
i = -1;
while (++i < num)
@@ -54,9 +54,9 @@ bool philos_start(t_philo *philos, int num)
return (true);
}
-void philos_detach(t_philo *philos, int num)
+void philos_detach(t_philo *philos, long int num)
{
- int i;
+ long int i;
if (philos == NULL)
return ;