Contents


NAME

     using_threads - In a parallel environment, if called from  a
     serial  region of the master thread it returns the number of
     threads available  for  execution  (determined  by  function
     OMP_GET_NUM_THREADS).   Else,  if it is called from a thread
     in the team executing the parallel region it returns a 1.

     USING_THREADS subroutine

SYNOPSIS

     INTEGER FUNCTION USING_THREADS()

     INTEGER*8 FUNCTION USING_THREADS_64()

  F95 INTERFACE
     INTEGER FUNCTION USING_THREADS()

     INTEGER(8) FUNCTION USING_THREADS_64()

  C INTERFACE
     #include <sunperf.h>

     int using_threads();

     long using_threads_64();

PURPOSE

     In a parallel environment, if called from a serial region of
     the  master  thread  USING_THREADS  returns  the  number  of
     threads available for execution.  This number is  determined
     by function call OMP_GET_NUM_THREADS (See the specifications
     for the OpenMP  Fortran  Application  Program  Interface  at
     http://www.openmp.org      for      more      details     on
     OMP_GET_NUM_THREADS).  Else, if it is called from  a  thread
     in  the  team executing the parallel region, it returns a 1.
     A user routine can call using_threads to determine if it  is
     already  in  a parallel region.  If this is the case, a 1 is
     returned and the routine can choose the serial path  instead
     of going parallel, thus avoiding nested parallellism.