19 lines
339 B
C
19 lines
339 B
C
#include "philo.h"
|
|
|
|
int destroy_mutexes(t_rules *rules)
|
|
{
|
|
int i;
|
|
|
|
i = 0;
|
|
if (pthread_mutex_destroy(rules->finished_lock))
|
|
return(FAILURE);
|
|
if (pthread_mutex_destroy(rules->print_lock))
|
|
return(FAILURE);
|
|
while (i < rules->n_philos)
|
|
{
|
|
if (pthread_mutex_destroy(&rules->forks[i]))
|
|
return(FAILURE);
|
|
i++;
|
|
}
|
|
return (SUCCESS);
|
|
} |