From 21c03264e65042db3b5856fba8a6cd1099438f96 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Fri, 25 Aug 2023 20:03:23 +0100 Subject: (main|file-handler)~fixed some stuff Big bug with file handler: I can write data well, but reading it causes some trace error which I cannot be bothered to fix. So I'll just work on making the step function way more efficient. --- main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index a4a36b0..0a8e97a 100644 --- a/main.c +++ b/main.c @@ -116,9 +116,12 @@ int main(void) } if (state.thread_alive) - pthread_cancel(step_thread); + { + state.thread_alive = false; + pthread_join(step_thread, NULL); + } - write_to_file(&state, "data.out"); CloseWindow(); + free(state.data); return 0; } -- cgit v1.2.3-13-gbd6f