2 * Test program for std::atomic<>
4 * See also https://bugs.kde.org/show_bug.cgi?id=328490.
13 std::atomic
<bool> g_b
;
15 void *func1(void *instance
)
18 timespec delay
= { 0, 100 * 1000 * 1000 };
19 nanosleep(&delay
, NULL
);
24 void *func2(void *instance
)
30 int main(int argc
, char* argv
[])
36 std::cerr
<< "Started.\n";
41 err
= pthread_create(&thread1
, NULL
, &func1
, NULL
);
43 throw std::string("failed to create a thread.");
44 err
= pthread_create(&thread2
, NULL
, &func2
, NULL
);
46 throw std::string("failed to create a thread.");
48 err
= pthread_join(thread1
, NULL
);
50 throw std::string("Thread::join(): failed to join.");
51 err
= pthread_join(thread2
, NULL
);
53 throw std::string("Thread::join(): failed to join.");
55 std::cerr
<< "Done.\n";