-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstate_utils_set.c
More file actions
34 lines (29 loc) · 1.34 KB
/
Copy pathstate_utils_set.c
File metadata and controls
34 lines (29 loc) · 1.34 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* state_utils_set.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dporhomo <dporhomo@student.42prague.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/06/15 13:33:26 by dporhomo #+# #+# */
/* Updated: 2026/06/15 13:36:52 by dporhomo ### ########.fr */
/* */
/* ************************************************************************** */
/* State variables: Reads and sets simulation active */
#include "codexion.h"
/* Safe way to read sim_active */
int read_sim_active(t_program *prog)
{
int active;
pthread_mutex_lock(&prog->state_lock);
active = prog->sim_active;
pthread_mutex_unlock(&prog->state_lock);
return (active);
}
/* Safe way to stop the simulation */
void set_sim_finished(t_program *prog)
{
pthread_mutex_lock(&prog->state_lock);
prog->sim_active = 0;
pthread_mutex_unlock(&prog->state_lock);
}