2
下面的代碼重新錯誤:年超出有效範圍時傳遞pos_infin如超時TIMED_WAIT
#include <iostream>
#include "boost/thread.hpp"
#include "boost/date_time/posix_time/ptime.hpp"
int main()
{
boost::condition_variable_any cv;
boost::timed_mutex m;
try {
{
boost::timed_mutex::scoped_timed_lock guard(m);
cv.timed_wait(guard, boost::posix_time::ptime(
boost::posix_time::pos_infin));
}
}
catch(std::exception & e) {
std::cout << "Error : " << e.what() << std::endl;
}
std::cout << "Done" << std::endl;
return 0;
}
在我的系統,使用Visual Studio 2005和Boost 1.43,這將產生以下輸出:
Error : Year is out of valid range: 1400..10000
Done
我希望它死鎖,等待條件變量通知所有永恆。這似乎沒有記錄在任何地方,我也希望timed_wait
接受任何有效的ptime
。我做錯了什麼?這是一個錯誤,還是無限超時只是沒有打算?
無法在Linux上使用1.45.0重現此處。你可以嘗試,如果這是固定在1.45.0? – chris 2011-01-13 10:08:26