mise a la norme
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2022/01/26 15:27:23 by hulamy #+# #+# */
|
/* Created: 2022/01/26 15:27:23 by hulamy #+# #+# */
|
||||||
/* Updated: 2022/01/31 00:13:26 by hulamy ### ########.fr */
|
/* Updated: 2022/01/31 10:20:22 by hulamy ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -28,7 +28,6 @@ typedef struct s_params
|
|||||||
int t_eat;
|
int t_eat;
|
||||||
int t_slp;
|
int t_slp;
|
||||||
int n_eat;
|
int n_eat;
|
||||||
long start_time;
|
|
||||||
} t_params;
|
} t_params;
|
||||||
|
|
||||||
typedef struct s_global
|
typedef struct s_global
|
||||||
|
|||||||
213
philo/race.log
213
philo/race.log
@@ -1,213 +0,0 @@
|
|||||||
==22761== Helgrind, a thread error detector
|
|
||||||
==22761== Copyright (C) 2007-2017, and GNU GPL'd, by OpenWorks LLP et al.
|
|
||||||
==22761== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
|
|
||||||
==22761== Command: ./philo 5 500 200 200 5
|
|
||||||
==22761==
|
|
||||||
==22761== ---Thread-Announcement------------------------------------------
|
|
||||||
==22761==
|
|
||||||
==22761== Thread #3 was created
|
|
||||||
==22761== at 0x518470E: clone (clone.S:71)
|
|
||||||
==22761== by 0x4E4BEC4: create_thread (createthread.c:100)
|
|
||||||
==22761== by 0x4E4BEC4: pthread_create@@GLIBC_2.2.5 (pthread_create.c:797)
|
|
||||||
==22761== by 0x4C38A27: ??? (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
|
|
||||||
==22761== by 0x400E29: launch (launch.c:85)
|
|
||||||
==22761== by 0x4007DD: main (main.c:24)
|
|
||||||
==22761==
|
|
||||||
==22761== ----------------------------------------------------------------
|
|
||||||
==22761==
|
|
||||||
==22761== Thread #3: lock order "0x54542E8 before 0x54541F8" violated
|
|
||||||
==22761==
|
|
||||||
==22761== Observed (incorrect) order is: acquisition of lock at 0x54541F8
|
|
||||||
==22761== at 0x4C3603C: ??? (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
|
|
||||||
==22761== by 0x4011BC: eat (exec.c:27)
|
|
||||||
==22761== by 0x401119: philo_exec (exec.c:72)
|
|
||||||
==22761== by 0x4C38C26: ??? (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
|
|
||||||
==22761== by 0x4E4B6DA: start_thread (pthread_create.c:463)
|
|
||||||
==22761== by 0x518471E: clone (clone.S:95)
|
|
||||||
==22761==
|
|
||||||
==22761== followed by a later acquisition of lock at 0x54542E8
|
|
||||||
==22761== at 0x4C3603C: ??? (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
|
|
||||||
==22761== by 0x401226: eat (exec.c:32)
|
|
||||||
==22761== by 0x401119: philo_exec (exec.c:72)
|
|
||||||
==22761== by 0x4C38C26: ??? (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
|
|
||||||
==22761== by 0x4E4B6DA: start_thread (pthread_create.c:463)
|
|
||||||
==22761== by 0x518471E: clone (clone.S:95)
|
|
||||||
==22761==
|
|
||||||
==22761== Lock at 0x54542E8 was first observed
|
|
||||||
==22761== at 0x4C39F2A: pthread_mutex_init (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
|
|
||||||
==22761== by 0x400C85: lst_add_philo (init.c:25)
|
|
||||||
==22761== by 0x400B9D: init_chain_philo (init.c:49)
|
|
||||||
==22761== by 0x4008CD: init (init.c:127)
|
|
||||||
==22761== by 0x4007B5: main (main.c:21)
|
|
||||||
==22761== Address 0x54542e8 is 24 bytes inside a block of size 176 alloc'd
|
|
||||||
==22761== at 0x4C32F2F: malloc (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
|
|
||||||
==22761== by 0x400C31: lst_add_philo (init.c:19)
|
|
||||||
==22761== by 0x400B9D: init_chain_philo (init.c:49)
|
|
||||||
==22761== by 0x4008CD: init (init.c:127)
|
|
||||||
==22761== by 0x4007B5: main (main.c:21)
|
|
||||||
==22761== Block was alloc'd by thread #1
|
|
||||||
==22761==
|
|
||||||
==22761== Lock at 0x54541F8 was first observed
|
|
||||||
==22761== at 0x4C39F2A: pthread_mutex_init (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
|
|
||||||
==22761== by 0x400C85: lst_add_philo (init.c:25)
|
|
||||||
==22761== by 0x400B9D: init_chain_philo (init.c:49)
|
|
||||||
==22761== by 0x4008CD: init (init.c:127)
|
|
||||||
==22761== by 0x4007B5: main (main.c:21)
|
|
||||||
==22761== Address 0x54541f8 is 24 bytes inside a block of size 176 alloc'd
|
|
||||||
==22761== at 0x4C32F2F: malloc (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
|
|
||||||
==22761== by 0x400C31: lst_add_philo (init.c:19)
|
|
||||||
==22761== by 0x400B9D: init_chain_philo (init.c:49)
|
|
||||||
==22761== by 0x4008CD: init (init.c:127)
|
|
||||||
==22761== by 0x4007B5: main (main.c:21)
|
|
||||||
==22761== Block was alloc'd by thread #1
|
|
||||||
==22761==
|
|
||||||
==22761==
|
|
||||||
==22761== ---Thread-Announcement------------------------------------------
|
|
||||||
==22761==
|
|
||||||
==22761== Thread #5 was created
|
|
||||||
==22761== at 0x518470E: clone (clone.S:71)
|
|
||||||
==22761== by 0x4E4BEC4: create_thread (createthread.c:100)
|
|
||||||
==22761== by 0x4E4BEC4: pthread_create@@GLIBC_2.2.5 (pthread_create.c:797)
|
|
||||||
==22761== by 0x4C38A27: ??? (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
|
|
||||||
==22761== by 0x400E29: launch (launch.c:85)
|
|
||||||
==22761== by 0x4007DD: main (main.c:24)
|
|
||||||
==22761==
|
|
||||||
==22761== ----------------------------------------------------------------
|
|
||||||
==22761==
|
|
||||||
==22761== Thread #5: lock order "0x54544C8 before 0x54543D8" violated
|
|
||||||
==22761==
|
|
||||||
==22761== Observed (incorrect) order is: acquisition of lock at 0x54543D8
|
|
||||||
==22761== at 0x4C3603C: ??? (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
|
|
||||||
==22761== by 0x4011BC: eat (exec.c:27)
|
|
||||||
==22761== by 0x401119: philo_exec (exec.c:72)
|
|
||||||
==22761== by 0x4C38C26: ??? (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
|
|
||||||
==22761== by 0x4E4B6DA: start_thread (pthread_create.c:463)
|
|
||||||
==22761== by 0x518471E: clone (clone.S:95)
|
|
||||||
==22761==
|
|
||||||
==22761== followed by a later acquisition of lock at 0x54544C8
|
|
||||||
==22761== at 0x4C3603C: ??? (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
|
|
||||||
==22761== by 0x401226: eat (exec.c:32)
|
|
||||||
==22761== by 0x401119: philo_exec (exec.c:72)
|
|
||||||
==22761== by 0x4C38C26: ??? (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
|
|
||||||
==22761== by 0x4E4B6DA: start_thread (pthread_create.c:463)
|
|
||||||
==22761== by 0x518471E: clone (clone.S:95)
|
|
||||||
==22761==
|
|
||||||
==22761== Lock at 0x54544C8 was first observed
|
|
||||||
==22761== at 0x4C39F2A: pthread_mutex_init (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
|
|
||||||
==22761== by 0x400C85: lst_add_philo (init.c:25)
|
|
||||||
==22761== by 0x400B9D: init_chain_philo (init.c:49)
|
|
||||||
==22761== by 0x4008CD: init (init.c:127)
|
|
||||||
==22761== by 0x4007B5: main (main.c:21)
|
|
||||||
==22761== Address 0x54544c8 is 24 bytes inside a block of size 176 alloc'd
|
|
||||||
==22761== at 0x4C32F2F: malloc (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
|
|
||||||
==22761== by 0x400C31: lst_add_philo (init.c:19)
|
|
||||||
==22761== by 0x400B9D: init_chain_philo (init.c:49)
|
|
||||||
==22761== by 0x4008CD: init (init.c:127)
|
|
||||||
==22761== by 0x4007B5: main (main.c:21)
|
|
||||||
==22761== Block was alloc'd by thread #1
|
|
||||||
==22761==
|
|
||||||
==22761== Lock at 0x54543D8 was first observed
|
|
||||||
==22761== at 0x4C39F2A: pthread_mutex_init (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
|
|
||||||
==22761== by 0x400C85: lst_add_philo (init.c:25)
|
|
||||||
==22761== by 0x400B9D: init_chain_philo (init.c:49)
|
|
||||||
==22761== by 0x4008CD: init (init.c:127)
|
|
||||||
==22761== by 0x4007B5: main (main.c:21)
|
|
||||||
==22761== Address 0x54543d8 is 24 bytes inside a block of size 176 alloc'd
|
|
||||||
==22761== at 0x4C32F2F: malloc (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
|
|
||||||
==22761== by 0x400C31: lst_add_philo (init.c:19)
|
|
||||||
==22761== by 0x400B9D: init_chain_philo (init.c:49)
|
|
||||||
==22761== by 0x4008CD: init (init.c:127)
|
|
||||||
==22761== by 0x4007B5: main (main.c:21)
|
|
||||||
==22761== Block was alloc'd by thread #1
|
|
||||||
==22761==
|
|
||||||
==22761==
|
|
||||||
==22761== ---Thread-Announcement------------------------------------------
|
|
||||||
==22761==
|
|
||||||
==22761== Thread #2 was created
|
|
||||||
==22761== at 0x518470E: clone (clone.S:71)
|
|
||||||
==22761== by 0x4E4BEC4: create_thread (createthread.c:100)
|
|
||||||
==22761== by 0x4E4BEC4: pthread_create@@GLIBC_2.2.5 (pthread_create.c:797)
|
|
||||||
==22761== by 0x4C38A27: ??? (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
|
|
||||||
==22761== by 0x400E29: launch (launch.c:85)
|
|
||||||
==22761== by 0x4007DD: main (main.c:24)
|
|
||||||
==22761==
|
|
||||||
==22761== ----------------------------------------------------------------
|
|
||||||
==22761==
|
|
||||||
==22761== Thread #2: lock order "0x54541F8 before 0x54545B8" violated
|
|
||||||
==22761==
|
|
||||||
==22761== Observed (incorrect) order is: acquisition of lock at 0x54545B8
|
|
||||||
==22761== at 0x4C3603C: ??? (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
|
|
||||||
==22761== by 0x4011BC: eat (exec.c:27)
|
|
||||||
==22761== by 0x401119: philo_exec (exec.c:72)
|
|
||||||
==22761== by 0x4C38C26: ??? (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
|
|
||||||
==22761== by 0x4E4B6DA: start_thread (pthread_create.c:463)
|
|
||||||
==22761== by 0x518471E: clone (clone.S:95)
|
|
||||||
==22761==
|
|
||||||
==22761== followed by a later acquisition of lock at 0x54541F8
|
|
||||||
==22761== at 0x4C3603C: ??? (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
|
|
||||||
==22761== by 0x401226: eat (exec.c:32)
|
|
||||||
==22761== by 0x401119: philo_exec (exec.c:72)
|
|
||||||
==22761== by 0x4C38C26: ??? (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
|
|
||||||
==22761== by 0x4E4B6DA: start_thread (pthread_create.c:463)
|
|
||||||
==22761== by 0x518471E: clone (clone.S:95)
|
|
||||||
==22761==
|
|
||||||
==22761== Lock at 0x54541F8 was first observed
|
|
||||||
==22761== at 0x4C39F2A: pthread_mutex_init (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
|
|
||||||
==22761== by 0x400C85: lst_add_philo (init.c:25)
|
|
||||||
==22761== by 0x400B9D: init_chain_philo (init.c:49)
|
|
||||||
==22761== by 0x4008CD: init (init.c:127)
|
|
||||||
==22761== by 0x4007B5: main (main.c:21)
|
|
||||||
==22761== Address 0x54541f8 is 24 bytes inside a block of size 176 alloc'd
|
|
||||||
==22761== at 0x4C32F2F: malloc (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
|
|
||||||
==22761== by 0x400C31: lst_add_philo (init.c:19)
|
|
||||||
==22761== by 0x400B9D: init_chain_philo (init.c:49)
|
|
||||||
==22761== by 0x4008CD: init (init.c:127)
|
|
||||||
==22761== by 0x4007B5: main (main.c:21)
|
|
||||||
==22761== Block was alloc'd by thread #1
|
|
||||||
==22761==
|
|
||||||
==22761== Lock at 0x54545B8 was first observed
|
|
||||||
==22761== at 0x4C39F2A: pthread_mutex_init (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
|
|
||||||
==22761== by 0x400C85: lst_add_philo (init.c:25)
|
|
||||||
==22761== by 0x400B9D: init_chain_philo (init.c:49)
|
|
||||||
==22761== by 0x4008CD: init (init.c:127)
|
|
||||||
==22761== by 0x4007B5: main (main.c:21)
|
|
||||||
==22761== Address 0x54545b8 is 24 bytes inside a block of size 176 alloc'd
|
|
||||||
==22761== at 0x4C32F2F: malloc (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
|
|
||||||
==22761== by 0x400C31: lst_add_philo (init.c:19)
|
|
||||||
==22761== by 0x400B9D: init_chain_philo (init.c:49)
|
|
||||||
==22761== by 0x4008CD: init (init.c:127)
|
|
||||||
==22761== by 0x4007B5: main (main.c:21)
|
|
||||||
==22761== Block was alloc'd by thread #1
|
|
||||||
==22761==
|
|
||||||
==22761==
|
|
||||||
[0;37m5 5 has taken a fork[0m
|
|
||||||
[0;37m15 5 has taken a fork[0m
|
|
||||||
[1;33m16 5 is eating[0m
|
|
||||||
[0;37m29 3 has taken a fork[0m
|
|
||||||
[0;37m30 3 has taken a fork[0m
|
|
||||||
[1;33m32 3 is eating[0m
|
|
||||||
[0;37m42 2 has taken a fork[0m
|
|
||||||
[1;34m224 5 is sleeping[0m
|
|
||||||
[0;37m228 1 has taken a fork[0m
|
|
||||||
[1;34m234 3 is sleeping[0m
|
|
||||||
[0;37m237 2 has taken a fork[0m
|
|
||||||
[1;33m238 2 is eating[0m
|
|
||||||
[0;37m240 4 has taken a fork[0m
|
|
||||||
[0;37m241 4 has taken a fork[0m
|
|
||||||
[1;33m242 4 is eating[0m
|
|
||||||
[1;32m428 5 is thinking[0m
|
|
||||||
[1;32m435 3 is thinking[0m
|
|
||||||
[1;34m440 2 is sleeping[0m
|
|
||||||
[0;37m443 1 has taken a fork[0m
|
|
||||||
[1;33m444 1 is eating[0m
|
|
||||||
[0;37m447 3 has taken a fork[0m
|
|
||||||
[0;37m449 5 has taken a fork[0m
|
|
||||||
[0;37m450 3 has taken a fork[0m
|
|
||||||
[1;33m451 3 is eating[0m
|
|
||||||
[1;34m452 4 is sleeping[0m
|
|
||||||
[1;31m516 5 died[0m
|
|
||||||
==22761==
|
|
||||||
==22761== For counts of detected and suppressed errors, rerun with: -v
|
|
||||||
==22761== Use --history-level=approx or =none to gain increased speed, at
|
|
||||||
==22761== the cost of reduced accuracy of conflicting-access information
|
|
||||||
==22761== ERROR SUMMARY: 3 errors from 3 contexts (suppressed: 6158 from 111)
|
|
||||||
@@ -1,3 +1,15 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* exec.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: hulamy <hulamy@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2022/01/31 10:23:55 by hulamy #+# #+# */
|
||||||
|
/* Updated: 2022/01/31 10:25:02 by hulamy ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "philo.h"
|
#include "philo.h"
|
||||||
|
|
||||||
static void action_delay(t_philo *philo, int action_time)
|
static void action_delay(t_philo *philo, int action_time)
|
||||||
@@ -22,6 +34,25 @@ static int ret_err_unlock(t_mtx *fork1, t_mtx *fork2)
|
|||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Thread #3: lock order "0x54542E8 before 0x54541F8" violated
|
||||||
|
|
||||||
|
Observed (incorrect) order is: acquisition of lock at 0x54541F8
|
||||||
|
at 0x4C3603C: ??? (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
|
||||||
|
by 0x4011BC: eat (exec.c:27)
|
||||||
|
by 0x401119: philo_exec (exec.c:72)
|
||||||
|
by 0x4C38C26: ??? (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
|
||||||
|
by 0x4E4B6DA: start_thread (pthread_create.c:463)
|
||||||
|
by 0x518471E: clone (clone.S:95)
|
||||||
|
|
||||||
|
followed by a later acquisition of lock at 0x54542E8
|
||||||
|
at 0x4C3603C: ??? (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
|
||||||
|
by 0x401226: eat (exec.c:32)
|
||||||
|
by 0x401119: philo_exec (exec.c:72)
|
||||||
|
by 0x4C38C26: ??? (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
|
||||||
|
by 0x4E4B6DA: start_thread (pthread_create.c:463)
|
||||||
|
by 0x518471E: clone (clone.S:95)
|
||||||
|
*/
|
||||||
static int eat(t_philo *philo, t_mtx *fork1, t_mtx *fork2)
|
static int eat(t_philo *philo, t_mtx *fork1, t_mtx *fork2)
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(fork1);
|
pthread_mutex_lock(fork1);
|
||||||
@@ -35,7 +66,6 @@ static int eat(t_philo *philo, t_mtx *fork1, t_mtx *fork2)
|
|||||||
update_time(philo);
|
update_time(philo);
|
||||||
if (print_message(philo, B_YELLOW, "is eating"))
|
if (print_message(philo, B_YELLOW, "is eating"))
|
||||||
return (ret_err_unlock(fork1, fork2));
|
return (ret_err_unlock(fork1, fork2));
|
||||||
|
|
||||||
action_delay(philo, philo->params->t_eat);
|
action_delay(philo, philo->params->t_eat);
|
||||||
pthread_mutex_lock(&(philo->m_eat));
|
pthread_mutex_lock(&(philo->m_eat));
|
||||||
philo->eat_count++;
|
philo->eat_count++;
|
||||||
@@ -46,14 +76,11 @@ static int eat(t_philo *philo, t_mtx *fork1, t_mtx *fork2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** fork1 = &(philo->m_fork);
|
if (philo->p_nbr % 2 == 0)
|
||||||
** fork2 = &(philo->m_fork);
|
{
|
||||||
** if (philo->global->t_start.ts == 0)
|
fork1 = &(philo->next->m_fork);
|
||||||
** if (philo->p_nbr < philo->params->n_phi / 2)
|
fork2 = &(philo->m_fork);
|
||||||
** if (philo->p_nbr % 2 == 0)
|
}
|
||||||
** fork1 = &(philo->next->m_fork);
|
|
||||||
** else
|
|
||||||
** fork2 = &(philo->next->m_fork);
|
|
||||||
*/
|
*/
|
||||||
void *philo_exec(void *arg)
|
void *philo_exec(void *arg)
|
||||||
{
|
{
|
||||||
@@ -79,22 +106,3 @@ void *philo_exec(void *arg)
|
|||||||
}
|
}
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
==22761== Thread #3: lock order "0x54542E8 before 0x54541F8" violated
|
|
||||||
==22761==
|
|
||||||
==22761== Observed (incorrect) order is: acquisition of lock at 0x54541F8
|
|
||||||
==22761== at 0x4C3603C: ??? (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
|
|
||||||
==22761== by 0x4011BC: eat (exec.c:27)
|
|
||||||
==22761== by 0x401119: philo_exec (exec.c:72)
|
|
||||||
==22761== by 0x4C38C26: ??? (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
|
|
||||||
==22761== by 0x4E4B6DA: start_thread (pthread_create.c:463)
|
|
||||||
==22761== by 0x518471E: clone (clone.S:95)
|
|
||||||
==22761==
|
|
||||||
==22761== followed by a later acquisition of lock at 0x54542E8
|
|
||||||
==22761== at 0x4C3603C: ??? (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
|
|
||||||
==22761== by 0x401226: eat (exec.c:32)
|
|
||||||
==22761== by 0x401119: philo_exec (exec.c:72)
|
|
||||||
==22761== by 0x4C38C26: ??? (in /usr/lib/valgrind/vgpreload_helgrind-amd64-linux.so)
|
|
||||||
==22761== by 0x4E4B6DA: start_thread (pthread_create.c:463)
|
|
||||||
==22761== by 0x518471E: clone (clone.S:95)
|
|
||||||
*/
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: hulamy <hulamy@student.42.fr> +#+ +:+ +#+ */
|
/* By: hulamy <hulamy@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2022/01/26 15:30:34 by hulamy #+# #+# */
|
/* Created: 2022/01/26 15:30:34 by hulamy #+# #+# */
|
||||||
/* Updated: 2022/01/31 00:07:05 by hulamy ### ########.fr */
|
/* Updated: 2022/01/31 10:20:25 by hulamy ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -85,7 +85,6 @@ static t_params *init_params(int ac, char **av)
|
|||||||
params->n_eat = -1;
|
params->n_eat = -1;
|
||||||
if (ac == 6)
|
if (ac == 6)
|
||||||
params->n_eat = ft_atoi(av[5]);
|
params->n_eat = ft_atoi(av[5]);
|
||||||
params->start_time = 0;
|
|
||||||
return (params);
|
return (params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: hulamy <hulamy@student.42.fr> +#+ +:+ +#+ */
|
/* By: hulamy <hulamy@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2022/01/26 15:30:49 by hulamy #+# #+# */
|
/* Created: 2022/01/26 15:30:49 by hulamy #+# #+# */
|
||||||
/* Updated: 2022/01/30 19:57:46 by hulamy ### ########.fr */
|
/* Updated: 2022/01/31 09:57:34 by hulamy ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@@ -87,11 +87,4 @@ void launch(t_philo *philo, pthread_t *id)
|
|||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
pere_fouettard(philo);
|
pere_fouettard(philo);
|
||||||
// i = 0;
|
|
||||||
// while (i < philo->params->n_phi)
|
|
||||||
// {
|
|
||||||
// pthread_mutex_unlock(&(philo->m_fork));
|
|
||||||
// philo = philo->next;
|
|
||||||
// i++;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user