c++中打印進程號和線程號

//pid 打印
#include <sys/types.h>
#include <unistd.h>

std::cout << "pid= " << getpid() << std::endl;


//tid打印
#include <thread>
std::cout << "tid=" << std::this_thread::get_id() << std::endl;

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章