kevin
kevin

Reputation: 14065

pthread.h header problem

hi I'm doing porting from Linux 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

Upvotes: 2

Views: 4807

Answers (3)

Kevin
Kevin

Reputation: 25269

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

Upvotes: 4

Dr. Snoopy
Dr. Snoopy

Reputation: 56357

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

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

Upvotes: 5

ildjarn
ildjarn

Reputation: 62975

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.

Upvotes: 1

Related Questions