vc++6.0 Configuration Pthread Library December 12, 2010 Sunday 13:14VC pthread multi-threaded programming reprint

Source: Internet
Author: User

vc++6.0 Configuration Pthread Library December 12, 2010 Sunday 13:14VC pthread multi-threaded programming reprint

#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>


void* Tprocess1 (void* args) {
int i=1;
while (i<=10) {
printf ("process1:%d\n", I);
i++;
}
return NULL;
}

void* Tprocess2 (void* args) {
int i=1;
while (i<=10) {
printf ("process2:%d\n", I);
i++;
}
return NULL;
}

int main () {
pthread_t T1;
pthread_t T2;
Pthread_create (&t1,null,tprocess1,null);
Pthread_create (&t2,null,tprocess2,null);
Pthread_join (T1,null);
Pthread_join (T2,null);
return 0;
}



Some configuration needs to be done before running:

1. Download Pthread's Windows Development Kit Pthreads-w32-2-4-0-release.exe (any one version available)

http://sourceware.org/pthreads-win32/, unzip to a directory.

2. Locate the Include and Lib folders, and add them below to the vc++6.0 header file path and the static link library path, respectively:

a). Tools->options, select the Directory page, and then select Include files (default) in Show directories for:

Add the path to the include in directories. In Show directories for: Select library files,

Add the path to the Lib in the directories.

b). project->settings, select the link page, and then add the *.lib file under Lib to the Object/library Modules,

Each lib file is separated by a space.

c). Copy the *.dll file under Lib to the project directory, which is the root directory.

vc++6.0 Configuration Pthread Library December 12, 2010 Sunday 13:14VC pthread multi-threaded programming reprint

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.