Created
November 26, 2011 18:22
-
-
Save Raynos/1396088 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) { | |
/* init vars */ | |
/* unpack arg */ | |
while (data->finished == 0) { | |
int barrier_result; | |
double** temp; | |
/* for each column. Only run columns the thread_num | |
is assigned to */ | |
for (column_count = thread_num; column_count < dim - 1; column_count+=threads) { | |
int row_count = 1; | |
innerloopcounter++; | |
for (;row_count < dim - 1; row_count++) { | |
/* manipulate value */ | |
} | |
} | |
/* barrier */ | |
barrier_result = pthread_barrier_wait(barrier); | |
/* for only one thread swap the source & target */ | |
if (barrier_result == PTHREAD_BARRIER_SERIAL_THREAD) { | |
temp = data->source; | |
data->source = data->target; | |
data->target = temp; | |
data->changed = 0; | |
} | |
pthread_barrier_wait(barrier); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment