summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2023-08-25 20:03:23 +0100
committerAryadev Chavali <aryadev@aryadevchavali.com>2023-08-25 20:03:23 +0100
commit21c03264e65042db3b5856fba8a6cd1099438f96 (patch)
treeda4208818b6703ffcff557574b030be6fb42984e /main.c
parent58970e8a68583e61e93091989af335cdac218085 (diff)
downloadabelian-sandpile-21c03264e65042db3b5856fba8a6cd1099438f96.tar.gz
abelian-sandpile-21c03264e65042db3b5856fba8a6cd1099438f96.tar.bz2
abelian-sandpile-21c03264e65042db3b5856fba8a6cd1099438f96.zip
(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.
Diffstat (limited to 'main.c')
-rw-r--r--main.c7
1 files changed, 5 insertions, 2 deletions
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;
}