Use of pthread library in windows environment

Asked

Viewed 2,111 times

2

Is it possible to work with the pthread library normally in a windows environment? Or should it only be in linux?

2 answers

5

How do you say here, that I find a very correct statement for the clarification of this doubt:

Pthreads is part of POSIX and Windows is not a system POSIX.

Anyway there is only one implementation of pthread.h for Windows call pthreads-win32, but does not have all the original functions. Here can see compliance with the original library. You can use it with Mingw or TDM-GCC.

  • Nice to know there’s a compatibility library. Remembering that even when Windows implemented a POSIX API (up to NT 4), there were no pthreads in it.

  • Perhaps it would be nice to add the recommendation to use a library that abstracts threads in both systems. There are several projects that run on Windows and UNIX, so I imagine there should be a good number of thread abstractions to make this easier. Type: Tinycthread (https://tinycthread.github.io/).

-5

It is possible yes, just use wsl 2, which simulates a linux system inside linux. Another way, which also uses the former is through containers (Dockers). Visual Studio Code supports all these tools. There are videos on Youtube about all this!!!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.