/* ************************************************************************** */ /* */ /* ::: o_ :::::: ::: */ /* synchronize_philos.c :+: / :+::+: :+: */ /* +:+ > +:++:+ +:+ */ /* By: whaffman +#+ +:+ +#++#++:++#++ */ /* +#+ +#+#+ +#++#+ +#+ \o/ */ /* Created: 2025/01/27 14:14:04 by whaffman #+#+# #+#+# #+# #+# | */ /* Updated: 2025/01/27 14:14:04 by whaffman ### ### ### ### / \ */ /* */ /* ************************************************************************** */ #include "philo.h" void synchronize_philos(t_philo *philo) { pthread_mutex_lock(philo->rules->finished_lock); pthread_mutex_unlock(philo->rules->finished_lock); pthread_mutex_lock(philo->last_meal_lock); philo->last_meal = get_time(); pthread_mutex_unlock(philo->last_meal_lock); if (philo->id % 2 == 0) { print_status(philo, "is thinking"); usleep(philo->rules->time_to_eat * 10); } }