开发者

pthread.h header problem

hi I'm doing porting from L开发者_如何学Pythoninux to Visual C++ . When I built the coding, it shows that VC ++ doesn't know this pthread.h header. I can't comment it since there is a variable " pthread_mutex_t " in the code. What should I do ? Does VC ++ has equivalent header for it?

Kevin


There is a pthreads implementation for Windows, it's called pthread-w32:

http://sourceware.org/pthreads-win32/


I don't think you'll find pthreads on windows unless you're using cygwin or something similar. Try the windows specific CriticalSection: http://msdn.microsoft.com/en-us/library/ms682530(v=vs.85).aspx

Or use boost which should work on both windows and unix: http://www.boost.org/doc/libs/release/doc/html/thread/synchronization.html


Windows has no native support for pthreads. If you want to use pthreads on Windows without significant code changes, you may want to look into Cygwin or one of the myriad other pthread ports.

That said, in my opinion your best move is to use an cross-platform threading library to begin with, such as boost.thread.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜