37 #include <gtest/gtest.h>
39 #include <boost/thread.hpp>
40 #include <boost/bind/bind.hpp>
48 : done_protecting_(false)
62 boost::mutex::scoped_lock lock(mutex_);
63 done_protecting_ =
true;
69 printf(
"protecting thread is sleeping\n");
70 boost::this_thread::sleep(boost::posix_time::microseconds(5000000));
71 printf(
"protecting thread is exiting\n");
87 boost::mutex::scoped_lock lock(mutex_);
88 while (!done_protecting_) {
89 cond_.timed_wait(lock, boost::posix_time::milliseconds(100));
93 printf(
"About to destruct\n");
95 printf(
"Done destructing\n");
125 int main(
int argc,
char ** argv)
127 testing::InitGoogleTest(&argc, argv);
130 return RUN_ALL_TESTS();