mirror of
https://github.com/autc04/Retro68.git
synced 2024-11-04 13:06:01 +00:00
48 lines
414 B
C
48 lines
414 B
C
#include <stdlib.h>
|
|
#include <omp.h>
|
|
|
|
struct S
|
|
{
|
|
static int s;
|
|
int v;
|
|
S ()
|
|
{
|
|
#pragma omp atomic
|
|
s++;
|
|
}
|
|
|
|
S (int x)
|
|
{
|
|
#pragma omp atomic
|
|
s++;
|
|
v = x;
|
|
}
|
|
|
|
~S ()
|
|
{
|
|
#pragma omp atomic
|
|
s--;
|
|
}
|
|
|
|
S (const S &x)
|
|
{
|
|
#pragma omp atomic
|
|
s++;
|
|
v = x.v;
|
|
}
|
|
|
|
static void
|
|
verify ()
|
|
{
|
|
if (s) abort ();
|
|
}
|
|
|
|
void
|
|
bump ()
|
|
{
|
|
v++;
|
|
}
|
|
};
|
|
|
|
int S::s = 0;
|