25 lines
684 B
C++
25 lines
684 B
C++
/* Generated by configure */
|
|
#include <atomic>
|
|
typedef void (*fptr)(int);
|
|
typedef std::atomic<fptr> atomicfptr;
|
|
void testfunction(int) { }
|
|
void test(volatile atomicfptr &a)
|
|
{
|
|
fptr v = a.load(std::memory_order_acquire);
|
|
while (!a.compare_exchange_strong(v, &testfunction,
|
|
std::memory_order_acq_rel,
|
|
std::memory_order_acquire)) {
|
|
v = a.exchange(&testfunction);
|
|
}
|
|
a.store(&testfunction, std::memory_order_release);
|
|
}
|
|
int main(int argc, char **argv)
|
|
{
|
|
(void)argc; (void)argv;
|
|
/* BEGIN TEST: */
|
|
atomicfptr fptr(testfunction);
|
|
test(fptr);
|
|
/* END TEST */
|
|
return 0;
|
|
}
|