summaryrefslogtreecommitdiff
path: root/testsuite/tests/rts/atomicinc.c
blob: 8f1c8bf3edfee391d3c198fec2eae488a7ae859e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#define THREADED_RTS

#include "Rts.h"

StgWord i;

int main(int argc, char *argv[])
{
    StgWord j;

    i = 0;
    j = atomic_inc(&i);
    CHECK(j == 1);
    CHECK(i == 1);

    j = atomic_dec(&i);
    CHECK(j == 0);
    CHECK(i == 0);

    return 0;
}