Rewrite semaphore initialization, add end semaphore
authorLukas Jiriste <ljiriste@student.42prague.com>
Tue, 28 May 2024 12:48:39 +0000 (14:48 +0200)
committerLukas Jiriste <ljiriste@student.42prague.com>
Tue, 28 May 2024 14:07:18 +0000 (16:07 +0200)
commita124a0c436276fb0a6578a940d7b7259580df202
tree27b3ed862d885cc5285d1cb6c1281172bfec1687
parent45e328e3303a3567cef49d7f8589ec1b3f77228f
Rewrite semaphore initialization, add end semaphore

It is better to create semaphores at 0 than at some value and then
subtracting them to 0.

The end semaphore will be used to signal to philosophers they should
end. This mechanism was chosen instead of kill function, because the
philosophers have to clean after themselves and signal
handlers cannot be used.
philo_bonus/mem_management.c
philo_bonus/philo.h