我想等待條件達1秒鐘。我已經嘗試傳遞TIME_DURATION:如何獲得boost :: condition :: timed_wait來編譯?
boost::posix_time::time_duration td = boost::posix_time::milliseconds(50);
readerThread_cond_.timed_wait(lock, boost::bind(&XXXX::writeCondIsMet, this), td);
,但我得到的錯誤:
/usr/include/boost/thread/pthread/condition_variable.hpp:156: error: no match for ‘operator+’ in ‘boost::get_system_time() + wait_duration’
我也試過路過一個xtime的:
boost::xtime t;
boost::xtime_get(&t, boost::TIME_UTC);
readerThread_cond_.timed_wait(lock, boost::bind(&XXXX::writeCondIsMet, this), td);
,但我得到的錯誤:
我與libboost_thread和libboost_date_time鏈接,代碼編譯並運行正常,當我使用只是使用等待,但錯誤信息似乎與解決boost頭文件中的模板有關。這似乎是說我沒有通過正確的事情,但我只是不明白這一點。
我其實在一分鐘前計算出來,但你得到的功勞。謝謝 – 2010-02-13 21:45:04