LLVM OpenMP
20.0.0git
Toggle main menu visibility
Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
c
d
e
g
h
i
m
n
p
r
s
t
u
Functions
c
d
e
g
i
m
n
p
r
s
u
Variables
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
z
~
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
w
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
Typedefs
Enumerations
Enumerator
Related Functions
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
Typedefs
_
a
b
c
d
e
i
k
l
m
n
o
p
r
t
u
Enumerations
_
b
c
d
f
k
l
n
o
s
t
Enumerator
_
a
b
c
d
e
f
k
l
n
o
p
r
s
t
Macros
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
runtime
test
lock
omp_lock.c
Go to the documentation of this file.
1
// RUN: %libomp-compile-and-run
2
// RUN: env KMP_LOCK_KIND=tas KMP_SPIN_BACKOFF_PARAMS=2048,200 %libomp-run
3
// RUN: env KMP_LOCK_KIND=futex %libomp-run
4
#include <stdio.h>
5
#include "
omp_testsuite.h
"
6
7
omp_lock_t
lck
;
8
9
int
test_omp_lock
()
10
{
11
int
nr_threads_in_single = 0;
12
int
result
= 0;
13
int
nr_iterations = 0;
14
int
i
;
15
16
omp_init_lock(&
lck
);
17
#pragma omp parallel shared(lck)
18
{
19
#pragma omp for
20
for
(
i
= 0;
i
<
LOOPCOUNT
;
i
++) {
21
omp_set_lock(&
lck
);
22
#pragma omp flush
23
nr_threads_in_single++;
24
#pragma omp flush
25
nr_iterations++;
26
nr_threads_in_single--;
27
result
=
result
+ nr_threads_in_single;
28
omp_unset_lock(&
lck
);
29
}
30
}
31
omp_destroy_lock(&
lck
);
32
33
return
((
result
== 0) && (nr_iterations ==
LOOPCOUNT
));
34
}
35
36
int
main
()
37
{
38
int
i
;
39
int
num_failed=0;
40
41
for
(
i
= 0;
i
<
REPETITIONS
;
i
++) {
42
if
(!
test_omp_lock
()) {
43
num_failed++;
44
}
45
}
46
return
num_failed;
47
}
result
int result[2]
Definition:
cancellation_for_sections.c:13
i
#define i
Definition:
kmp_stub.cpp:87
test_omp_lock
int test_omp_lock()
Definition:
omp_lock.c:9
lck
omp_lock_t lck
Definition:
omp_lock.c:7
main
int main()
Definition:
omp_lock.c:36
omp_testsuite.h
LOOPCOUNT
#define LOOPCOUNT
Definition:
omp_testsuite.h:12
REPETITIONS
#define REPETITIONS
Definition:
omp_testsuite.h:13
Generated on Mon May 26 2025 20:58:10 for LLVM OpenMP by
1.9.6