]> git.ipfire.org Git - thirdparty/gcc.git/blob - libgomp/doc/openmp-runtime-library-routines/ompgetthreadnum.rst
sphinx: add missing trailing newline
[thirdparty/gcc.git] / libgomp / doc / openmp-runtime-library-routines / ompgetthreadnum.rst
1 ..
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.
5
6 .. _omp_get_thread_num:
7
8 omp_get_thread_num -- Current thread ID
9 ***************************************
10
11 Description:
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.
17
18 C/C++:
19 .. list-table::
20
21 * - *Prototype*:
22 - ``int omp_get_thread_num(void);``
23
24 Fortran:
25 .. list-table::
26
27 * - *Interface*:
28 - ``integer function omp_get_thread_num()``
29
30 See also:
31 :ref:`omp_get_num_threads`, :ref:`omp_get_ancestor_thread_num`
32
33 Reference:
34 :openmp:`4.5`, Section 3.2.4.