OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [libgomp/] [testsuite/] [libgomp.c++/] [ctor-5.C] - Blame information for rev 859

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 273 jeremybenn
// { dg-do run }
2
// { dg-require-effective-target tls_runtime }
3
 
4
#include 
5
#include 
6
 
7
struct B
8
{
9
  static int count;
10
  static B *expected;
11
 
12
  B& operator=(const B &);
13
};
14
 
15
int B::count;
16
B * B::expected;
17
 
18
static B thr;
19
#pragma omp threadprivate(thr)
20
 
21
B& B::operator= (const B &b)
22
{
23
  assert (&b == expected);
24
  assert (this != expected);
25
  #pragma omp atomic
26
    count++;
27
  return *this;
28
}
29
 
30
static int nthreads;
31
 
32
void foo()
33
{
34
  B::expected = &thr;
35
 
36
  #pragma omp parallel copyin(thr)
37
    {
38
    #pragma omp master
39
      nthreads = omp_get_num_threads ();
40
    }
41
}
42
 
43
int main()
44
{
45
  omp_set_dynamic (0);
46
  omp_set_num_threads (4);
47
  foo();
48
 
49
  assert (B::count == nthreads-1);
50
 
51
  return 0;
52
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.