HOME
| OPENMP API Specification: Version 5.0 November 2018

3.2.4  omp_get_thread_num

SummaryThe omp_get_thread_num routine returns the thread number, within the current team, of the calling thread.

Format

SVG-Viewer needed.

 

 
int omp_get_thread_num(void);  

SVG-Viewer needed.

SVG-Viewer needed.

 

 
integer function omp_get_thread_num()  

SVG-Viewer needed.

BindingThe binding thread set for an omp_get_thread_num region is the current team. The binding region for an omp_get_thread_num region is the innermost enclosing parallel region.

EffectThe omp_get_thread_num routine returns the thread number of the calling thread, within the team that is executing the parallel region to which the routine region binds. The thread number is an integer between 0 and one less than the value returned by omp_get_num_threads, inclusive. The thread number of the master thread of the team is 0. The routine returns 0 if it is called from the sequential part of a program.

SVG-Viewer needed.

Note – The thread number may change during the execution of an untied task. The value returned by omp_get_thread_num is not generally useful during the execution of such a task region.

SVG-Viewer needed.

Cross References