随笔分类 - C/C++多线程
摘要:函数声明: int pthread_once(pthread_once_t *once_control, void (*init_routine) (void)); 本函数使用初值为PTHREAD_ONCE_INIT的once_control变量保证init_routine()函数在本进程执行序列中
阅读全文
摘要:头文件:<thread> 方法1:获取指定线程的线程id std::thread::id 方法2:获取当前线程的线程id std::this_thread::get_id() 案例解析: void foo() { while (1) { std::cout << "std::this_thread:
阅读全文