Software Archive
Read-only legacy content
17061 Discussions

Cilkscreen and __sync_add_and_fetch

zardosht_kasheff
Beginner
628 Views
The following simple program causes cilkscreen to report an error.

#include
#include
#include


volatile int x;
void race(int b)
{
__sync_add_and_fetch(&x, b);
}

void race1(int b)
{
__sync_add_and_fetch(&x, b);
}

void test(void)
{
cilk_spawn race(1);
cilk_spawn race1(2);
}

int main(int argc, char *argv[])
{
x = 0;
test();

printf("done: x = %d\\n", x);
return 0;
}
0 Kudos
2 Replies
Brandon_H_Intel
Employee
628 Views
Hello Zardosht!

I can reproduce this problem with Cilkscreen and I've submitteda problem report on this. I'll update the thread when we have a resolution. What kind of urgency do you have here for this problem?
0 Kudos
zardosht_kasheff
Beginner
628 Views
Hello Brandon,

At the moment, we are using the _InterlockedXXX functions as a replacement, so this is not terribly urgent.

-Zardosht
0 Kudos
Reply