Using pthread.h to build Windows

I have a codebase that uses pthread.h extensively. In the Windows visual studio project, this obviously does not work, since pthreads is a unix utility.

I know there is pthread-win32 or something like that, but is there a way to use this codebase without replacing all the pthread code?

edit: I would prefer that you don't have to go through and replace all pthread calls. This is my question

+7
c ++ c pthreads
source share
3 answers

Try http://sourceware.org/pthreads-win32/ . Although I never used this particular library, I was lucky to use some windows / abstractions of the Windows POSIX API.

+5
source share

I would recommend boost as a library containing platform-independent abstract abstraction. I do not think that you will find any attempt to call the pthread functions yourself in order to be satisfactory. It is also not very difficult to compare pthread with Win32 for yourself.

+5
source share

If the code is very heavily based on * nix, you will probably be able to compile it using Cygwin + GCC. If pthreads is the only nix dependency and you want to avoid the Cygwin dependency, then you should go with Pthreads-win32 .

+2
source share

All Articles