summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2023-08-27 22:10:05 +0100
committerAryadev Chavali <aryadev@aryadevchavali.com>2023-08-27 22:10:05 +0100
commit0965b02fedafb493a38a3bfc66c128b35a532519 (patch)
treed03f6d7550d9fa3fe66f4f470a70a82f91ea7830 /main.c
parent65bb0e0f66a2218b59c9537436f1f75166994651 (diff)
downloadabelian-sandpile-0965b02fedafb493a38a3bfc66c128b35a532519.tar.gz
abelian-sandpile-0965b02fedafb493a38a3bfc66c128b35a532519.tar.bz2
abelian-sandpile-0965b02fedafb493a38a3bfc66c128b35a532519.zip
(main)+comments
Diffstat (limited to 'main.c')
-rw-r--r--main.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/main.c b/main.c
index 65a6954..a745426 100644
--- a/main.c
+++ b/main.c
@@ -78,7 +78,9 @@ int main(int argc, char *argv[])
Camera2D camera = {0};
camera.zoom = 1.0f;
+ // Initialise mutex for threads to use
pthread_mutex_init(&mutex, NULL);
+ // Setup quadrants (for threads)
struct StepArg a = {&state, 0, state.dwidth / 2, 0, state.dwidth / 2};
struct StepArg b = {&state, 0, state.dwidth / 2, state.dwidth / 2,
state.dwidth};
@@ -86,6 +88,7 @@ int main(int argc, char *argv[])
state.dwidth / 2};
struct StepArg d = {&state, state.dwidth / 2, state.dwidth, state.dwidth / 2,
state.dwidth};
+ // Setup threads
pthread_t thread_a, thread_b, thread_c, thread_d;
pthread_create(&thread_a, NULL, &compute_thread, &a);
pthread_create(&thread_b, NULL, &compute_thread, &b);