zklim / 42-Philosophers

0 stars 0 forks source link

Forks #2

Closed nwhean closed 1 year ago

nwhean commented 1 year ago

It may be a good idea to define a fork data structure that contains just that. https://github.com/zklim/42-Philosophers/blob/a9987e94f711269cbdda5af41e2cb518326db07b/philo/philo.h#L47

Then define functions like fork_take and fork_release that deals with all these mutex. This is an abstraction that allows you to write your code in a much more readable fashion. So your eat function would call those instead.