-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclean_utils.c
More file actions
35 lines (31 loc) · 1.38 KB
/
Copy pathclean_utils.c
File metadata and controls
35 lines (31 loc) · 1.38 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
30
31
32
33
34
35
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* clean_utils.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dporhomo <dporhomo@student.42prague.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/06/11 12:38:44 by dporhomo #+# #+# */
/* Updated: 2026/06/14 01:39:06 by dporhomo ### ########.fr */
/* */
/* ************************************************************************** */
/* Destroys mutexes, conds, frees memory */
#include "codexion.h"
void clean_mutexes_and_coders(t_program *prog, t_coder *coders)
{
int i;
i = -1;
while (++i < prog->num_coders)
{
pthread_mutex_destroy(&prog->dongles[i]);
pthread_cond_destroy(&prog->coder_cond[i]);
}
pthread_mutex_destroy(&prog->print_lock);
pthread_mutex_destroy(&prog->arbitrator);
pthread_mutex_destroy(&prog->state_lock);
pq_free(&prog->pq);
free(prog->dongles);
free(prog->coder_cond);
free(prog->dongle_ready_time);
free(coders);
}