/* By: ljiriste <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/05 12:49:40 by ljiriste #+# #+# */
-/* Updated: 2024/03/19 11:55:01 by ljiriste ### ########.fr */
+/* Updated: 2024/03/19 13:39:27 by ljiriste ### ########.fr */
/* */
/* ************************************************************************** */
}
}
+int handle_single_philo(t_settings *set)
+{
+ set->program_start = cur_time_sus();
+ thread_print(set, 1, "is thinking");
+ thread_print(set, 1, "has taken a fork");
+ usleep(set->time_to_die);
+ thread_print(set, 1, "died");
+ return (0);
+}
+
int main(int argc, char **argv)
{
t_settings settings;
printf("Invalid input arguments.\n");
return (1);
}
+ if (settings.philo_count == 1)
+ return (handle_single_philo(&settings));
threads = malloc(sizeof(pthread_t) * settings.philo_count);
forks = init_forks(settings.philo_count);
philos = build_philos(forks, &settings);