线程值pthread_self函数使用



#include  
#include  
#include 
#include


#include//getpid函数的使用


#pragma comment(lib, "pthreadVC2.lib")  //必须加上这句  




void*thread_func(void*arg)
{
printf("thread id=%lu\n",pthread_self());
return arg;
}


int main(void){
pid_t pid;
pthread_t tid;
pid = getpid();
printf("process id=%lu\n", pid);
    pthread_create(&tid, NULL, thread_func, NULL);
    pthread_join(tid,NULL);


return 0;

}



你可能感兴趣的:(C开发笔记,多线程)