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

获取进程ID:

原型:

#include <unistd.h>

pid_t getpid(void);

返回调用进程的进程ID。

获取线程ID:

原型:

#include <pthread.h>

pthread_t pthread_self(void);

返回调用线程的线程ID。

原文地址:https://www.cnblogs.com/ruigelwang/p/13163336.html