-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug.c
More file actions
29 lines (27 loc) · 1.32 KB
/
debug.c
File metadata and controls
29 lines (27 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* debug.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: kacherch <kacherch@student.42lyon.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/04/30 09:45:53 by kacherch #+# #+# */
/* Updated: 2026/04/30 09:46:08 by kacherch ### ########.fr */
/* */
/* ************************************************************************** */
#include "coders.h"
int debug(t_coder *coder)
{
pthread_mutex_lock(coder->config->mutex_output);
if (check_exit(coder->config))
{
pthread_mutex_unlock(coder->config->mutex_output);
return (1);
}
printf("%ld %d is debugging\n", get_time() - coder->config->begin_timestamp,
coder->id);
pthread_mutex_unlock(coder->config->mutex_output);
usleep(coder->config->time_to_debug * 1000);
pthread_cond_broadcast(coder->config->cond_top_prio);
return (0);
}