mirror of
https://github.com/autc04/Retro68.git
synced 2024-12-02 18:53:22 +00:00
30 lines
585 B
C
30 lines
585 B
C
#include <omp.h>
|
|
#include <stdlib.h>
|
|
|
|
struct S { S () : s (42) {} S (const S &x) : s (x.s) {}; ~S () {} int s; };
|
|
|
|
int
|
|
main ()
|
|
{
|
|
S s;
|
|
s.s = 113;
|
|
#pragma omp parallel num_threads(4) default(firstprivate)
|
|
{
|
|
if (s.s != 113)
|
|
abort ();
|
|
s.s = omp_get_thread_num ();
|
|
#pragma omp barrier
|
|
if (s.s != omp_get_thread_num ())
|
|
abort ();
|
|
}
|
|
#pragma omp parallel num_threads(4) default(private)
|
|
{
|
|
if (s.s != 42)
|
|
abort ();
|
|
s.s = omp_get_thread_num () + 13;
|
|
#pragma omp barrier
|
|
if (s.s != omp_get_thread_num () + 13)
|
|
abort ();
|
|
}
|
|
}
|