(main)+comments
This commit is contained in:
3
main.c
3
main.c
@@ -78,7 +78,9 @@ int main(int argc, char *argv[])
|
|||||||
Camera2D camera = {0};
|
Camera2D camera = {0};
|
||||||
camera.zoom = 1.0f;
|
camera.zoom = 1.0f;
|
||||||
|
|
||||||
|
// Initialise mutex for threads to use
|
||||||
pthread_mutex_init(&mutex, NULL);
|
pthread_mutex_init(&mutex, NULL);
|
||||||
|
// Setup quadrants (for threads)
|
||||||
struct StepArg a = {&state, 0, state.dwidth / 2, 0, state.dwidth / 2};
|
struct StepArg a = {&state, 0, state.dwidth / 2, 0, state.dwidth / 2};
|
||||||
struct StepArg b = {&state, 0, state.dwidth / 2, state.dwidth / 2,
|
struct StepArg b = {&state, 0, state.dwidth / 2, state.dwidth / 2,
|
||||||
state.dwidth};
|
state.dwidth};
|
||||||
@@ -86,6 +88,7 @@ int main(int argc, char *argv[])
|
|||||||
state.dwidth / 2};
|
state.dwidth / 2};
|
||||||
struct StepArg d = {&state, state.dwidth / 2, state.dwidth, state.dwidth / 2,
|
struct StepArg d = {&state, state.dwidth / 2, state.dwidth, state.dwidth / 2,
|
||||||
state.dwidth};
|
state.dwidth};
|
||||||
|
// Setup threads
|
||||||
pthread_t thread_a, thread_b, thread_c, thread_d;
|
pthread_t thread_a, thread_b, thread_c, thread_d;
|
||||||
pthread_create(&thread_a, NULL, &compute_thread, &a);
|
pthread_create(&thread_a, NULL, &compute_thread, &a);
|
||||||
pthread_create(&thread_b, NULL, &compute_thread, &b);
|
pthread_create(&thread_b, NULL, &compute_thread, &b);
|
||||||
|
|||||||
Reference in New Issue
Block a user