]> git.ipfire.org Git - thirdparty/gcc.git/blame - libgomp/doc/the-libgomp-abi/implementing-single-construct.rst
sphinx: add missing trailing newline
[thirdparty/gcc.git] / libgomp / doc / the-libgomp-abi / implementing-single-construct.rst
CommitLineData
c63539ff
ML
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.. _implementing-single-construct:
7
8Implementing SINGLE construct
9*****************************
10
11A block like
12
13.. code-block:: c++
14
15 #pragma omp single
16 {
17 body;
18 }
19
20becomes
21
22.. code-block:: c++
23
24 if (GOMP_single_start ())
25 body;
26 GOMP_barrier ();
27
28while
29
30.. code-block:: c++
31
32 #pragma omp single copyprivate(x)
33 body;
34
35becomes
36
37.. code-block:: c++
38
39 datap = GOMP_single_copy_start ();
40 if (datap == NULL)
41 {
42 body;
43 data.x = x;
44 GOMP_single_copy_end (&data);
45 }
46 else
47 x = datap->x;
3ed1b4ce 48 GOMP_barrier ();