void* do_job(void* _arg) { TAU_REGISTER_THREAD(); { prime_arg_t arg = _arg; int j = 0; #if 0 printf("JOBS = %d\n", arg[0].jobs); #endif while(j < arg[0].jobs) { pthread_mutex_lock(&m); if (arg[j].stolen == 0) { arg[j].stolen = 1; pthread_mutex_unlock(&m); arg[j].sum = check_primes(arg[j].start, arg[j].end); } else { pthread_mutex_unlock(&m); } j++; } } return NULL; }
void child(void* args) { TAU_REGISTER_THREAD(); sleep(6); printf("Child\n"); }