fix: work with odd numbers of philos
This commit is contained in:
parent
d6aee63600
commit
891431c1be
2
philo.c
2
philo.c
@ -87,7 +87,7 @@ void *philo_routine(void *arg)
|
|||||||
philo = arg;
|
philo = arg;
|
||||||
data = philo->data;
|
data = philo->data;
|
||||||
print_thinking(philo);
|
print_thinking(philo);
|
||||||
usleep((philo->id * (data->life_expectency / data->nb_philos)) * 1000);
|
usleep((philo->id % 2) * (data->eat_time) * 1000);
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
if (check(philo, data))
|
if (check(philo, data))
|
||||||
|
Loading…
Reference in New Issue
Block a user