Sunday 15 January 2012

windows - mingw-w64 threads: posix vs win32 -


I am installing mingw-w64 on Windows and there are two options: win32 threads and posex threads. I know what is the difference between Win32 Thread and Pthreads, but I do not know what is the difference between these two options. I suspect that if I select the posix threads then I will be prevented from calling the WinAPI function like CreateThread .

It seems that this option specifies which threading API will be used by some program or library, but what? GCC, LIBSTDC ++ or something else?

I have found this:

In short, for this version of Mingav, Thread-Pausix will use the release Pausix API and use the Std :: thread Allow, and threads will use the Win32-Win32 API, and will disable the std :: thread portion of the standard.

OK, if I will choose win32 thread then std :: thread will be unavailable but Win32 Thread will still be used. GCC comes with a compiler Runtime Library (Libigasy) that uses it (in between). Other Things) which supports languages, provides a low-level OS dissociation to the related functionality in those languages. The most relevant example is libstdc ++ of C ++ 11 & lt; Thread & gt; , & lt; Mutex & gt; , and & lt; Future & gt; GCG is built with its internal Win32 Threading model when a complete implementation of MinGW-W64 provides a winpthreads (a pthreads implementation on the top of the Win32 Multithreading API) that enable GCC then all fancy features Can link to

I have to emphasize that you can not refuse to write any code that you want (this is absolutely no effect on your no API, Can call) It only indicates that GCC's Runtime Libraries (libgcc / libstdc ++ / ...) use for its functionality, warned by @ James, nothing to do with GCC's internal threading model, but rather Microsoft's CRT implementation Is with.

  • posix : Enable C ++ 11 / C11 multithreading features. Libgcc depends on libwinpthreads, so that you do not directly call the pthreads API, you will distribute the winpthreads DLL.
  • win32 : There is no C ++ 11 multithreading features.

    The Win32 API or the pthreads API phone on any user code that has no effect. You can always use both.

No comments:

Post a Comment