fix: lock mutex
This commit is contained in:
parent
4e27d103a8
commit
622c2bf226
2
main.c
2
main.c
@ -19,7 +19,9 @@ size_t get_min_meal(t_data *data)
|
|||||||
t_philo *philo;
|
t_philo *philo;
|
||||||
|
|
||||||
philo = data->philos[0];
|
philo = data->philos[0];
|
||||||
|
pthread_mutex_lock(&philo->nb_meal_mutex);
|
||||||
min = philo->nb_meal;
|
min = philo->nb_meal;
|
||||||
|
pthread_mutex_unlock(&philo->nb_meal_mutex);
|
||||||
i = 1;
|
i = 1;
|
||||||
while (i < data->nb_philos)
|
while (i < data->nb_philos)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user