static void free_team (struct gomp_team *team) { gomp_barrier_destroy (&team->barrier); gomp_mutex_destroy (&team->task_lock); free (team); }
int main (int argc, char *argv[]) { long i; int res; pthread_t thr[4]; fprintf(stderr, "starting\n"); gomp_barrier_init( &bar, 4 ); for (i = 0; i < 4; i++) { res = pthread_create( &thr[i], NULL, child, (void*)(i+2) ); assert(!res); } for (i = 0; i < 4; i++) { res = pthread_join( thr[i], NULL ); assert(!res); } gomp_barrier_destroy( &bar ); /* And finally here, the root thread can get exclusive ownership back from thread #4, because #4 has exited by this point and so we have a dependency edge back to the write it did. */ fprintf(stderr, "done, result is %ld, should be 88\n", unprotected); return 0; }
static void free_team (struct gomp_team *team) { free (team->work_shares); gomp_mutex_destroy (&team->work_share_lock); gomp_barrier_destroy (&team->barrier); gomp_sem_destroy (&team->master_release); free (team); }
static void free_team (struct gomp_team *team) { #ifndef HAVE_SYNC_BUILTINS gomp_mutex_destroy (&team->work_share_list_free_lock); #endif gomp_barrier_destroy (&team->barrier); gomp_mutex_destroy (&team->task_lock); free (team); }