bart | f68af88 | 2011-12-10 19:42:05 +0000 | [diff] [blame] | 1 | // Test whether no race conditions are reported on std::thread. Note: since |
| 2 | // the implementation of std::thread uses the shared pointer implementation, |
| 3 | // that implementation has to be annotated in order to avoid false positives. |
| 4 | // See also http://gcc.gnu.org/onlinedocs/libstdc++/manual/debug.html for more |
| 5 | // information. |
| 6 | |
| 7 | #include "../../drd/drd.h" |
| 8 | #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(addr) \ |
| 9 | ANNOTATE_HAPPENS_BEFORE(addr) |
| 10 | #define _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(addr) \ |
| 11 | ANNOTATE_HAPPENS_AFTER(addr) |
| 12 | #define _GLIBCXX_EXTERN_TEMPLATE -1 |
| 13 | |
| 14 | #include <iostream> |
| 15 | #include <thread> |
| 16 | |
| 17 | int main(int argc, char** argv) |
| 18 | { |
| 19 | std::thread t( []() { } ); |
| 20 | t.join(); |
| 21 | std::cerr << "Done.\n"; |
| 22 | return 0; |
| 23 | } |