当前位置:网站首页>pthread_ Why does self() repeat
pthread_ Why does self() repeat
2022-04-23 14:06:00 【JokerYourMemory】
Say first conclusion :
from pthread_self() Checked tid, Only unique in the process , Different processes may find the same tid.
cause :
Wrote a little program , The program will run as a main process fork There are two sub processes , Then the main process goes to sleep , After two sub processes are started , Also sleep .
There are four threads in total , During log observation, it is found that , For two subprocesses , they pthread_create Outgoing thread , It is called in the thread pthread_self() Print thread id, There are two of them , Then realize that it may not be the only one . Check it out , Someone explained earlier as follows :
explain :
“pthread_self yes posix Thread described ID( Not a real thread in the kernel id), Relative to the identification number of each process in the thread , For this process is the only , And in different processes , Per thread pthread_self() Maybe the return is the same .
and gettid What you get is the thread in the kernel ID”
Quote from :https://blog.csdn.net/weixin_43204126/article/details/98236147
版权声明
本文为[JokerYourMemory]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231401090664.html
边栏推荐
猜你喜欢
Windos中安装labellmg教程
浅谈基于openssl的多级证书,Multi-level CA的签发和管理,以及双向认证
Use of WiFi module based on wechat applet
微信小程序setInterval定时函数使用详细教程
go 语言 数组,字符串,切片
groutine
程序编译调试学习记录
帆软实现分页时第一行和最后两行冻结方式
As a junior college student, I studied hard in closed doors for 56 days, won Ali offer with tears, five rounds of interviews and six hours of soul torture
基于CM管理的CDH集群集成Phoenix
随机推荐
Decimal 格式化小数位/DateTime 转换处理
Chrome插件 之 Selenium IDE、XPath 安装
多线程 @Async 线程池
烟雾传感器(mq-2)使用详细教程(基于树莓派3b+实现)
关于stream流,浅记一下------
JDBC详解
CDH cluster integration Phoenix based on CM management
微信小程序通过低功耗蓝牙设备进行定位及测距(二)
RobotFramework 之 用例标签机制
帆软实现分页时第一行和最后两行冻结方式
sql中出现一个变态问题
按实际取,每三级分类汇总一次,看图知需求
linux MySQL数据定时dump
帆软中根据分类进行汇总
数据库DbVisualizer Pro报文件错误,导致数据连接失败
Autumn recruitment in 2021, salary ranking No
Can I compile the header file and source file of the template separately
Chapter I review of e-commerce spike products
Three point positioning based on ibeacons (wechat applet)
Indoor and outdoor map switching (indoor three-point positioning based on ibeacons)