Merge branch 'master' of git.chauvet.pro:starnakin/42_Philosopher
This commit is contained in:
commit
550851a5c8
@ -6,7 +6,7 @@
|
||||
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/04/27 11:34:57 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/04/27 11:34:58 by cchauvet ### ########.fr */
|
||||
/* Updated: 2023/05/17 13:43:29 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -23,13 +23,15 @@ static bool check_amount_of_argument(size_t n)
|
||||
|
||||
static bool check_value(char **av, size_t n)
|
||||
{
|
||||
size_t i;
|
||||
size_t i;
|
||||
|
||||
i = 0;
|
||||
while (i < n)
|
||||
{
|
||||
if (ft_isnum(av[i]) == 0)
|
||||
return (1);
|
||||
if (!(ft_atoi(av[i]) > 0))
|
||||
return (1);
|
||||
i++;
|
||||
}
|
||||
return (0);
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/04/27 11:33:33 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/05/17 13:22:19 by cchauvet ### ########.fr */
|
||||
/* Updated: 2023/05/17 13:33:17 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -30,7 +30,7 @@ static void print(t_data *data, size_t id, char *str)
|
||||
if (stop == false)
|
||||
{
|
||||
time = get_time();
|
||||
printf("%zu %zu %s\n", time, id, str);
|
||||
printf("%07zu %07zu %s\n", time, id + 1, str);
|
||||
}
|
||||
pthread_mutex_unlock(&data->print_mutex);
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/04/27 11:41:14 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/05/17 13:21:33 by cchauvet ### ########.fr */
|
||||
/* Updated: 2023/05/17 13:33:33 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -22,6 +22,6 @@ void print_died(t_philo *philo)
|
||||
data = philo->data;
|
||||
time = get_time();
|
||||
pthread_mutex_lock(&data->print_mutex);
|
||||
printf("%7zu %3zu %s\n", time, philo->id, "died");
|
||||
printf("%07zu %03zu %s\n", time, philo->id + 1, "died");
|
||||
pthread_mutex_unlock(&data->print_mutex);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user