aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.c-c++-common/task-detach-4.c
blob: cd0d2b353d6d17c3d5709b520db7abc2cbc42a5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* { dg-do run } */

#include <omp.h>
#include <assert.h>

/* Test detach clause, where a task fulfills its own completion event.  */

int main (void)
{
  omp_event_handle_t detach_event;
  int x = 0;

  detach_event = (omp_event_handle_t) 0x123456789abcdef0;

  #pragma omp parallel
    #pragma omp single
      #pragma omp task detach (detach_event)
      {
	x++;
	omp_fulfill_event (detach_event);
      }

  assert (x == 1);
}