2 Copyright 1988-2022 Free Software Foundation, Inc.
3 This is part of the GCC manual.
4 For copying conditions, see the copyright.rst file.
6 .. _omp_get_thread_num:
8 omp_get_thread_num -- Current thread ID
9 ***************************************
12 Returns a unique thread identification number within the current team.
13 In a sequential parts of the program, ``omp_get_thread_num``
14 always returns 0. In parallel regions the return value varies
15 from 0 to ``omp_get_num_threads`` -1 inclusive. The return
16 value of the primary thread of a team is always 0.
22 - ``int omp_get_thread_num(void);``
28 - ``integer function omp_get_thread_num()``
31 :ref:`omp_get_num_threads`, :ref:`omp_get_ancestor_thread_num`
34 :openmp:`4.5`, Section 3.2.4.