Next: , Previous: omp_get_num_threads, Up: Runtime Library Routines


2.6 omp_get_thread_num – Current thread ID

Description:
Unique thread identification number. In a sequential parts of the program, omp_get_thread_num always returns 0. In parallel regions the return value varies from 0 to omp_get_max_threads-1 inclusive. The return value of the master thread of a team is always 0.
C/C++:

Prototype: int omp_get_thread_num();

Fortran:

Interface: integer function omp_get_thread_num()

See also:
omp_get_max_threads
Reference:
OpenMP specifications v2.5, section 3.2.4.