Linux系统编程之线程(二)

线程控制原语 pthread_self 函数 获取线程ID,其作用是对应进程中的getpid()函数 线程ID是进程内部识别标志(两个进程间,线程ID允许相同) 【注意】不应该使用全局变量pthread_t tid,在子线程中通过pthread_create传出参数来获取线程ID,而应该使用pthread_self pthread_create 函数 创建一个线程 线程与共享 【牢记】线程默认共享
相关文章
相关标签/搜索