Questions tagged [pthreads-win32]

pthreads-win32 provides an implementation of pthreads for Win32.

pthread-win32 - The POSIX 1003.1-2001 standard defines an application programming interface (API) for writing multithreaded applications. This interface is known more commonly as pthreads. A good number of modern operating systems include a threading library of some kind: Solaris (UI) threads, Win32 threads, DCE threads, DECthreads, or any of the draft revisions of the pthreads standard. The trend is that most of these systems are slowly adopting the pthreads standard API, with application developers following suit to reduce porting woes.

Win32 does not, and is unlikely to ever, support pthreads natively. This project seeks to provide a freely available and high-quality solution to this problem.

Various individuals have been working on independent implementations of this well-documented and standardised threading API, but most of them never see the light of day. The tendency is for people to only implement what they personally need, and that usually does not help others. This project attempts to consolidate these implementations into one implementation of pthreads for Win32.

Level of standards conformance

Pthreads-win32 currently implements a large subset of the POSIX standard threads related API. See our conformance page for a complete list of options and functions implemented as well as those that aren't.

HTML formatted manual pages are now available inside the package and on this site. Peruse them for additional Pthreads-win32 information.

How does it work?

The Win32 pthreads is normally implemented as a dynamic link library (DLL). This has some notable advantages from the Win32 point of view, but it also more closely models existing pthread libraries on UNIX which are usually shared objects (e.g. libpthread.so). Please note though, that the library can also be built for static linking if necessary.

Official Website: http://www.sourceware.org/pthreads-win32/

Useful Linkes:

52 questions
0
votes
0 answers

pthread-win32 issue , cmake, -1073741515 (0xC0000135)

I am trying to use pthread win-32 on windows, I created a sample application to test the pthread library but the program is working not properly, it is exciting with a minus error code. I am using MSVC for compiling, and cmake for building the…
0
votes
1 answer

Link issue on Windows with pthreads - Is gcc or SystemC to blame?

​ Hi, I've recently come across a link issue that I cannot explain. Here is an example that couldn't really be simpler: sc_main.cpp: #include int sc_main (int argc, char* argv[]) { sc_start(SC_ZERO_TIME); return(0); } I use the…
DaveC
  • 115
  • 8
0
votes
0 answers

PHP Startup: Unable to load dynamic library, Windows

I've installed PHP 7.4 on C:\Program Files\Php74 and it's working but when i try to load an extension, there is such error: PHP Warning: PHP Startup: Unable to load dynamic library 'php_pthreads.dll' (tried: C:\\php\\ext\\php_pthreads.dll…
AHHP
  • 2,967
  • 3
  • 33
  • 41
0
votes
1 answer

pthread_join not waiting on threads to finish

I am using pthreads.h on Windows, for a simple raytracer. It seems like the main function is not waiting for the threads to finish. When I just run the program like this(I now simplified it, to just test the threads, but it still gives the…
Kay Verbruggen
  • 111
  • 1
  • 1
  • 9
0
votes
0 answers

Passing HAVE_STRUCT_TIMESPEC directive to the NMAKE command line doesnt fix pthread

I am currently trying to build pthread-win32 from here (version 2.7.0). I have the project checked out and can run and view results of NMAKE VC-static from the VS2015 developer command prompt. I have an error when building: error C2011: 'timespec':…
Fantastic Mr Fox
  • 32,495
  • 27
  • 95
  • 175
0
votes
1 answer

pthreads multi-threaded matrix multiplication

I'm currently trying to write a C++ program with pthreads.h for multi-threaded matrix multiplication. I'm trying to create the threads as follows int numthreads = (matrix[0].size() * rsize2);//Calculates # of threads needed pthread_t…
0
votes
1 answer

Memory leakage in windows pthread. `pthread_join` does not deallocate memory

The simple test: void testMemoryLeak_PthreadCreateJoin(void) { auto taskFunction = [](void*args) -> void* { return nullptr; }; pthread_t pth; int err = pthread_create(&pth, /*attr*/nullptr, taskFunction, /*args*/nullptr); …
kyb
  • 7,233
  • 5
  • 52
  • 105
0
votes
1 answer

Calling a Python script from PHP using Multi-threading

I'm using PHP to display the Python output in the browser. Since the Python script takes a long time to print the output, The User Interface gets hung till the Python script finishes its execution. Pthreads for Windows is enabled in PHP for…
User456898
  • 5,704
  • 5
  • 21
  • 37
0
votes
1 answer

Error building libpthreads-stubs-0.3 on Windows

I am trying to compile libpthreads-stubs-0.3 (for vaapi) on a Windows machine which has MinGW and MSys environment. I have installed mingw32-pthreads-w32 dev package(version 2.9.1-1) in MinGW. Now when i try to compile libpthreads-stubs-0.3 (there…
Pawan
  • 1,614
  • 3
  • 18
  • 32
0
votes
2 answers

CppuTest: undefined reference to pthread during final linking

I'm a newby in cppuTest and actually I'm trying to build the ./examples within the CppuTest root directory. Source and Test files are compiled without problems but I'm stucking on the final linking stage where I get this…
JohnDoe
  • 825
  • 1
  • 13
  • 31
0
votes
1 answer

Building Log4cpp with Autotools: pthreads not found

community, I downloaded the Log4cpp source package form http://log4cpp.sourceforge.net/ and have problems building this library. To do it, I opened my cygwin-bash.exe, navigated to the root of the source package and typed ./configure. I get a lot of…
user172501
  • 332
  • 2
  • 11
0
votes
1 answer

pthread_mutex not waiting on timeout

I have the following code: bool Mutex::timed_lock(unsigned long milliseconds) { if (!milliseconds) { return lock(); } struct timespec ts; ts.tv_sec = milliseconds / 1000; ts.tv_nsec = (milliseconds - (ts.tv_sec *…
Brandon
  • 22,723
  • 11
  • 93
  • 186
0
votes
0 answers

pthread on MinGW 32 with eclipse 64 bit

I have MinGW32 and building a small piece of code using pthread on eclipse. The code compiles and links successfully, but terminates on running it with a non zero exit value. There are no warnings around this.However, on debugging it,it works fine.…
Neha
  • 1
  • 2
0
votes
1 answer

Implementing pthreads in .h and .cpp

The normal way to pass function as arguments in pthreads for pthread_create method is pthread_create(&thread,NULL,func,(void*)arg) while func() is declared/defined as void* func(void* arg); but whenever I want to call pthread_create it in…
Kamran
  • 152
  • 2
  • 13
0
votes
2 answers

C++ Can a pthread (Windows) be kept open to run a function multiple times?

I am currently testing out pthreads for usage in order to speed up other code I have. Essentially what my code currently has is a couple of for loops that end up doing matrix calculations. I tried spawning threads that will do those calculations…
G Boggs
  • 381
  • 1
  • 6
  • 19