C++ 创建一个boost::posix_time::ptime实例,以X毫秒为单位
构造器。C++ 创建一个boost::posix_time::ptime实例,以X毫秒为单位,c++,linux,boost,C++,Linux,Boost,构造器。 如何为X毫秒数创建作用域锁定 如果X是您在等待锁获取时想要花费的毫秒,那么此代码段应该可以帮助您: scoped_lock(mutex_type & m, const boost::posix_time::ptime & abs_time); 如果X是您在等待锁获取时想要花费的毫秒数,那么此代码段应该可以帮助您: scoped_lock(mutex_type & m, const boost::posix_time::ptime & abs_time)
如何为X毫秒数创建作用域锁定 如果X是您在等待锁获取时想要花费的毫秒,那么此代码段应该可以帮助您:
scoped_lock(mutex_type & m, const boost::posix_time::ptime & abs_time);
如果X是您在等待锁获取时想要花费的毫秒数,那么此代码段应该可以帮助您:
scoped_lock(mutex_type & m, const boost::posix_time::ptime & abs_time);
Keynslug,非常感谢。除了从boost::ptime到boost::posix_time的更改之外,一切都正常。非常感谢您的批评,@Oded,谢谢您指出,我已经更正了名称空间。Keynslug,非常感谢。除了从boost::ptime到boost::posix_time的更改之外,一切都正常。“非常感谢您的批评,@Oded,谢谢您指出,我已经更正了名称空间。”。
boost::posix_time::ptime till = boost::posix_time::microsec_clock::local_time() +
boost::posix_time::milliseconds(X);
...
{
boost::interprocess::scoped_lock(some_mutex, till);
...
}