Fixed a bug in the end condition for threads

This commit is contained in:
Aram
2016-05-11 20:46:34 +02:00
parent 7a0ec5e052
commit 6d274c1a73
4 changed files with 32 additions and 0 deletions

View File

@ -660,6 +660,14 @@ int main (int argc, const char * argv[]) {
space = craptev1_get_space(nonces, 95, uid); space = craptev1_get_space(nonces, 95, uid);
} }
if(space){ if(space){
// append some zeroes to the end of the space to make sure threads don't go off into the wild
size_t j = 0;
for(j = 0; space[j]; j+=5){
}
size_t fill = j + (5*thread_count);
for(; j < fill; j++) {
space[j] = 0;
}
total_states = craptev1_sizeof_space(space); total_states = craptev1_sizeof_space(space);
} else { } else {
total_states = 0; total_states = 0;

View File

@ -49,6 +49,14 @@ int main(int argc, char* argv[]){
total_states = craptev1_sizeof_space(space); total_states = craptev1_sizeof_space(space);
thread_count = get_nprocs_conf(); thread_count = get_nprocs_conf();
// append some zeroes to the end of the space to make sure threads don't go off into the wild
size_t j = 0;
for(j = 0; space[j]; j+=5){
}
size_t fill = j + (5*thread_count);
for(; j < fill; j++) {
space[j] = 0;
}
pthread_t threads[thread_count]; pthread_t threads[thread_count];
size_t i; size_t i;

View File

@ -72,6 +72,14 @@ int main(int argc, char* argv[]){
total_states = craptev1_sizeof_space(space); total_states = craptev1_sizeof_space(space);
thread_count = get_nprocs_conf(); thread_count = get_nprocs_conf();
// append some zeroes to the end of the space to make sure threads don't go off into the wild
size_t j = 0;
for(j = 0; space[j]; j+=5){
}
size_t fill = j + (5*thread_count);
for(; j < fill; j++) {
space[j] = 0;
}
pthread_t threads[thread_count]; pthread_t threads[thread_count];
printf("Starting %zu threads to test %zu states\n", thread_count, total_states); printf("Starting %zu threads to test %zu states\n", thread_count, total_states);
size_t i; size_t i;

View File

@ -73,6 +73,14 @@ int main(int argc, char* argv[]){
total_states = craptev1_sizeof_space(space); total_states = craptev1_sizeof_space(space);
thread_count = get_nprocs_conf(); thread_count = get_nprocs_conf();
// append some zeroes to the end of the space to make sure threads don't go off into the wild
size_t j = 0;
for(j = 0; space[j]; j+=5){
}
size_t fill = j + (5*thread_count);
for(; j < fill; j++) {
space[j] = 0;
}
pthread_t threads[thread_count]; pthread_t threads[thread_count];
size_t i; size_t i;