Next: , Previous: , Up: OpenMP Runtime Library Routines   [Contents][Index]

3.25 omp_get_thread_num – Current thread ID


Returns a unique thread identification number within the current team. 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_num_threads-1 inclusive. The return value of the primary thread of a team is always 0.

Prototype:int omp_get_thread_num(void);
Interface:integer function omp_get_thread_num()
See also:

omp_get_num_threads – Size of the active team, omp_get_ancestor_thread_num – Ancestor thread ID


OpenMP specification v4.5, Section 3.2.4.