-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrefactor.c
More file actions
29 lines (27 loc) · 1.33 KB
/
refactor.c
File metadata and controls
29 lines (27 loc) · 1.33 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* refactor.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: kacherch <kacherch@student.42lyon.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/04/30 09:45:23 by kacherch #+# #+# */
/* Updated: 2026/04/30 09:46:06 by kacherch ### ########.fr */
/* */
/* ************************************************************************** */
#include "coders.h"
int refactor(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 refactoring\n", get_time()
- coder->config->begin_timestamp, coder->id);
pthread_mutex_unlock(coder->config->mutex_output);
usleep(coder->config->time_to_refactor * 1000);
pthread_cond_broadcast(coder->config->cond_top_prio);
return (0);
}