Add semaphore to each philo
authorLukas Jiriste <ljiriste@student.42prague.com>
Thu, 23 May 2024 07:52:46 +0000 (09:52 +0200)
committerLukas Jiriste <ljiriste@student.42prague.com>
Thu, 23 May 2024 07:52:46 +0000 (09:52 +0200)
commit20b3bffac789da5e1eb381a452ad6b333c311626
treefe74d7a17ac7d2dce9a93cd43464fb5ab56279c5
parent9ac3ddf1491fb62dc8bb33a0e1e977b15a520c5b
Add semaphore to each philo

To react fast to starving philosopher, there has to be another thread
checking the state of the philo. Because of this there has to be
a mechanism to prevent data race. Because mutexes are forbidden
it has to be a semaphore.
This commit contains the semaphore and some code that dictates
its usage.
philo_bonus/philo.c
philo_bonus/philo.h