What is Pthreads?
Pthreads is the standard API for creating and managing threads on UNIX systems. This API is not natively supported on Windows, but there is a free library called pthreads-w32 which provides the same functionality under Windows. In this way, you can develop a multi-threaded program which will work on both types of systems.Installation and Quickstart
1. Download library
Web: ftp://sourceware.org/pub/pthreads-win32/pthreads-w32-2-9-1-release.tar.gz2. Build library
make clean GC3. Install libs
mkdir "%userprofile%\lib\pthreads-w32"cp -v *.dll *.a "%userprofile%\lib\pthreads-w32"
4. Install header files
mkdir "%userprofile%\include\pthreads-w32"cp -v pthread.h sched.h semaphore.h "%userprofile%\include\pthreads-w32"
5. Update environment
Add static libs dir to LIBRARY_PATHAdd headers dir to CPATH
6. Compile a test program
(Using the test program fromhttps://computing.llnl.gov/tutorials/pthreads/#CreatingThreads)
gcc -o trythread trythread.c -lpthreadGC2
Keine Kommentare:
Kommentar veröffentlichen