所以我创建了一些代码。我用升压计时器。就是这里
while(1){
timerForCaptureFame.restart();
//some code
spendedTimeForCaptureFame = timerForCaptureFame.elapsed();
if(spendedTimeForCaptureFame < desiredTimeForCaptureFame){
boost::this_thread::sleep(boost::posix_time::milliseconds(desiredTimeForCaptureFame - spendedTimeForCaptureFame));
}
}发布于 2011-03-03 02:19:58
boost::this_thread::sleep(0)不应该“暂停线程”;它应该立即返回。已经发布了关于boost::this_thread::sleep挂起的错误报告,所以您可能遇到了这个错误-如果是这样的话,我将非常感激更多的细节,因为我自己无法重现它。
https://stackoverflow.com/questions/5121398
复制相似问题