Esempio n. 1
0
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;
}
Esempio n. 2
0
void child(void* args) {
  TAU_REGISTER_THREAD();
  sleep(6);
  printf("Child\n");
}