Skip to content

Commit

Permalink
[OMPT] Add synchronization to threads_nested.c testcase
Browse files Browse the repository at this point in the history
The testcase potentially fails when a thread is reused.
The added synchronization makes sure this does not happen.

Patch provided by Simon Convent

Differential Revision: https://reviews.llvm.org/D48932

llvm-svn: 336326
  • Loading branch information
jprotze committed Jul 5, 2018
1 parent 4660379 commit 00505b8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions openmp/runtime/test/ompt/misc/threads_nested.c
Expand Up @@ -4,14 +4,16 @@
#include <omp.h>

int main() {

int condition = 0;
int x = 0;
omp_set_nested(1);
#pragma omp parallel num_threads(2)
{
#pragma omp parallel num_threads(2)
{
#pragma omp atomic
x++;
OMPT_SIGNAL(condition);
OMPT_WAIT(condition, 4);
}
}

Expand Down

0 comments on commit 00505b8

Please sign in to comment.