projects
/
42
/
philosophers.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
bbc14ea
)
Make odd-numbered philos start 1 ms later
author
Lukas Jiriste
<ljiriste@student.42prague.com>
Thu, 26 Sep 2024 08:44:04 +0000
(10:44 +0200)
committer
Lukas Jiriste
<ljiriste@student.42prague.com>
Thu, 26 Sep 2024 08:44:04 +0000
(10:44 +0200)
This is done for even number of philos to behave orderly.
I am no sure whether this counts as interphilo communication though...
philo/philo.c
patch
|
blob
|
history
diff --git
a/philo/philo.c
b/philo/philo.c
index b8541c82c5fd6b3a1158102dbb36ed767ff9c23a..f0f52fcb7150ae3281548c5d9d01c0d9821b766a 100644
(file)
--- a/
philo/philo.c
+++ b/
philo/philo.c
@@
-82,6
+82,8
@@
void *be_a_philosopher(void *void_philo)
{
t_philo *const philo = void_philo;
+ if (philo->id % 2)
+ usleep(1000);
while (!end(philo->settings))
{
philo_think(philo);