#include #include #include #include #include "V.h" #include "W.h" void f( boost::barrier & b) { b.wait(); V v; printf("F::f() : %d\n", v.f() ); } void g( boost::barrier & b) { b.wait(); W w; printf("W::f() : %d\n", w.f() ); } int main( int argc, char *argv[]) { try { boost::barrier b( 2); boost::thread t1( boost::bind( f, boost::ref( b) ) ); boost::thread t2( boost::bind( g, boost::ref( b) ) ); t1.join(); t2.join(); return EXIT_SUCCESS; } catch ( std::exception const& e) { std::cerr << "exception: " << e.what() << std::endl; } catch ( ... ) { std::cerr << "unknown exception" << std::endl; } return EXIT_FAILURE; }