#include #include #include #include #include #include // g++ -o thread_equality -lboost_thread thread_equality.cpp // using namespace std; static boost::thread* myThread = 0; static boost::barrier* bar = 0; void func() { cout << "Barrier waiting in func" << endl; bar->wait(); cout << "Barrier waiting in func done" << endl; assert(myThread); boost::thread selfThread; assert(*myThread == selfThread); } int main() { bar = new boost::barrier(2); myThread = new boost::thread(&func); cout << "Barrier waiting in main" << endl; bar->wait(); cout << "Barrier waiting in main done" << endl; myThread->join(); return EXIT_SUCCESS; }