获取进程ID和线程ID ---- getpid、pthread_self

获取进程ID:

原型:

#include <unistd.h>

pid_t getpid(void);

返回调用进程的进程ID。

 

 

获取线程ID:

原型:

#include <pthread.h>

pthread_t pthread_self(void);

返回调用线程的线程ID。

posted @ 2020-06-19 15:32  Ruigel1  阅读(1173)  评论(0编辑  收藏  举报