首页 > 学院 > 开发设计 > 正文

线程值pthread_self函数使用

2019-11-06 06:37:59
字体:
来源:转载
供稿:网友
#include<stdio.h>  #include<pthread.h>  #include<Windows.h> #include<signal.h>#include<PRocess.h>//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;

}


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表