FreeBSD/contrib/gcclibs/libgomp/team.c
/* This function is a pthread_create entry point.  This contains the idle
   loop in which a thread waits to be called up to become part of a team.  */
This function is a pthread_create entry point.  This contains the idle
loop in which a thread waits to be called up to become part of a team.
This function is a pthread_create entry point . This contains the idle loop in which a thread waits to be called up to become part of a team .
static void *
gomp_thread_start (void *xdata)
{
  struct gomp_thread_start_data *data = xdata;
  struct gomp_thread *thr;
  void (*local_fn) (void *);
  void *local_data;
#ifdef HAVE_TLS
  thr = &gomp_tls_data;
#else
  struct gomp_thread local_thr;
  thr = &local_thr;
  pthread_setspecific (gomp_tls_key, thr);
#endif
  gomp_sem_init (&thr->release, 0);
  local_fn = data->fn;
  local_data = data->fn_data;
  thr->ts = data->ts;
  thr->ts.team->ordered_release[thr->ts.team_id] = &thr->release;
  if (data->nested)
    {
      gomp_barrier_wait (&thr->ts.team->barrier);
      local_fn (local_data);
      gomp_barrier_wait (&thr->ts.team->barrier);
    }
  else
    {
      gomp_threads[thr->ts.team_id] = thr;
      gomp_barrier_wait (&gomp_threads_dock);
      do
	{
	  struct gomp_team *team;
	  local_fn (local_data);
	  team = thr->ts.team;
	  thr->fn = NULL;
	  thr->data = NULL;
	  thr->ts.team = NULL;
	  thr->ts.work_share = NULL;
	  thr->ts.team_id = 0;
	  thr->ts.work_share_generation = 0;
	  thr->ts.static_trip = 0;
	  gomp_barrier_wait (&team->barrier);
	  gomp_barrier_wait (&gomp_threads_dock);
	  local_fn = thr->fn;
	  local_data = thr->data;
	}
      while (local_fn);
    }
  return NULL;
}
static void * gomp_thread_start ( void * xdata ) { struct gomp_thread_start_data * data = xdata ; struct gomp_thread * thr ; void ( * local_fn ) ( void * ) ; void * local_data ; #ifdef HAVE_TLS thr = & gomp_tls_data ; #else struct gomp_thread local_thr ; thr = & local_thr ; pthread_setspecific ( gomp_tls_key , thr ) ; #endif gomp_sem_init ( & thr -> release , 0 ) ; local_fn = data -> fn ; local_data = data -> fn_data ; thr -> ts = data -> ts ; thr -> ts . team -> ordered_release [ thr -> ts . team_id ] = & thr -> release ; if ( data -> nested ) { gomp_barrier_wait ( & thr -> ts . team -> barrier ) ; local_fn ( local_data ) ; gomp_barrier_wait ( & thr -> ts . team -> barrier ) ; } else { gomp_threads [ thr -> ts . team_id ] = thr ; gomp_barrier_wait ( & gomp_threads_dock ) ; do { struct gomp_team * team ; local_fn ( local_data ) ; team = thr -> ts . team ; thr -> fn = NULL ; thr -> data = NULL ; thr -> ts . team = NULL ; thr -> ts . work_share = NULL ; thr -> ts . team_id = 0 ; thr -> ts . work_share_generation = 0 ; thr -> ts . static_trip = 0 ; gomp_barrier_wait ( & team -> barrier ) ; gomp_barrier_wait ( & gomp_threads_dock ) ; local_fn = thr -> fn ; local_data = thr -> data ; } while ( local_fn ) ; } return NULL ; }
This function is a pthread_create entry point.
This function is a pthread_create entry point .
/* Extract what we need from data.  */ /* Clear out the team and function data.  This is a debugging
	     signal that we're in fact back in the dock.  */