- #include <boost/thread.hpp>
- #include <boost/thread/mutex.hpp>
- #include <string>
- #define BOOST_DATE_TIME_SOURCE
- #define BOOST_THREAD_NO_LIB
-
- using namespace boost;
-
- int main()
- {
- mutex mu;
-
- {
- mutex:: scoped_lock lock(mu);
- thread t1(print, std::string("Hello,"));
- t1.join();
- }
-
- {
- mutex:: scoped_lock lock(mu);
- thread t2(print, std::string("boost!"));
- t2.join();
- }
-
- std::cout << std::endl;
-
- return 0;
- }
|