1. LinuxThreads Frequently Asked Questions
http://cristal.inria.fr/~xleroy/linuxthreads/faq.html#F
Q: Where is pthread_yield()?
Because it's not part of the (final) POSIX 1003.1c standard. Several drafts of the standard contained pthread_yield()
, but then the POSIX guys discovered it was redundant withsched_yield()
and dropped it. So, just use sched_yield()
instead.
2. Mac OX 下没有实现clock_gettime()。参考下面的连接
http://www.wand.net.nz/~smr26/wordpress/2009/01/19/monotonic-time-in-mac-os-x/
pthread_cond_timedwait 要用到struct timespec ,可以如下转换:
struct timespec ts; struct timeval tv; int rc = gettimeofday(&tp, NULL);
/* Convert from timeval to timespec */ ts.tv_sec = tv.tv_sec; ts.tv_nsec = tv.tv_usec * 1000; ts.tv_sec += WAIT_TIME_SECONDS;
3. Making movies from image files using ffmpeg/mencoder
ffmpeg -r 10 -b 2048k -i %05d.jpg test1800.mp4
mencoder "mf://*.jpg" -mf fps=10 -o test.avi -ovc lavc -lavcopts vcodec=msmpeg4v2:vbitrate=8004. 关于isnan()
There is no isnan()
function available in current C++ Standard Library. It was introduced in C99 and defined as a macro not a function. Elements of standard library defined by C99 are not part of current C++ standard ISO/IEC 14882:1998 neither its update ISO/IEC 14882:2003.
cmath
includes C99 elements like
isnan()
,
isfinite()
, etc. but they are defined as functions, not macros, usually in
std::tr1::
namespace, though many implementations (i.e. GCC 4+ on Linux or in XCode on Mac OS X 10.5+) inject them directly to
std::
, so
std::isnan
is well defined.
所以很简单:using namespace std;