libgomp/testsuite/libgomp.c-c++-common/task-detach-4.c
raw| 1 | /* { dg-do run } */ |
| 2 | |
| 3 | #include <omp.h> |
| 4 | #include <assert.h> |
| 5 | |
| 6 | /* Test detach clause, where a task fulfills its own completion event. */ |
| 7 | |
| 8 | int main (void) |
| 9 | { |
| 10 | omp_event_handle_t detach_event; |
| 11 | int x = 0; |
| 12 | |
| 13 | detach_event = (omp_event_handle_t) 0x123456789abcdef0; |
| 14 | |
| 15 | #pragma omp parallel |
| 16 | #pragma omp single |
| 17 | #pragma omp task detach (detach_event) |
| 18 | { |
| 19 | x++; |
| 20 | omp_fulfill_event (detach_event); |
| 21 | } |
| 22 | |
| 23 | assert (x == 1); |
| 24 | } |