Using POSIX threads in Microsoft Visual Studio
Threads can be used to implement parallelism. For UNIX-based systems, a standardized C language threads programming interface has been specified by the IEEE POSIX 1003.1c standard. Implementations that adhere to this standard are referred to as POSIX threads, or Pthreads. Windows does not support pthreads directly, instead the Pthreads-w32 project seeks to provide a portable and open-source wrapper implementation. The first step is to obtain the pthread project from the following ftp site: ftp://sourceware.org/pub/pthreads-win32/ And extract it to a location of your choice: This will be the location of where your project dependencies and additional library files will be located. To demonstrate an example pthreads usage in a Microsoft Visual Studio environment, first create a new Empty Project: Add the main.cpp source file to your empty project and use the following code sample: [code language="cpp"] #include <pthread.h> #include <stdio.h>...