Created
November 24, 2011 21:40
-
-
Save Raynos/1392354 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void * thread_start(void *arg) { | |
while (1) { | |
/* for each column. Only run columns the thread_num | |
is assigned to */ | |
for (column_count = thread_num; column_count < dim - 1; column_count+=threads) { | |
/* do thread work for data chunk */ | |
} | |
/* barrier */ | |
barrier_result = pthread_barrier_wait(barrier); | |
if (not_finished == 0) { | |
/* finished */ | |
break; | |
/* break while loop, end thread. | |
The barrier is now broken because it is no longer | |
getting called by this thread */ | |
} | |
/* we are not finished, loop around and do thread work on next data chunk */ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment