当前位置:网站首页>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
边栏推荐
猜你喜欢

PATH环境变量

org.apache.parquet.schema.InvalidSchemaException: A group type can not be empty. Parquet does not su

Nodejs安装及环境配置

Program compilation and debugging learning record

程序编译调试学习记录

使用itextpdf实现截取pdf文档第几页到第几页,进行分片

RobotFramework 之 文件上传和下载

微信小程序调用客服接口

Subscription number development of wechat applet (message push)

浅谈基于openssl的多级证书,Multi-level CA的签发和管理,以及双向认证
随机推荐
生成随机高质量符合高斯分布的随机数
request模块
在MAC上安装mysql
Jmeter安装教程以及我遇到的问题的解决办法
PyMySQL
9月8日,临去松山湖的前夜
接口文档yaml
SQL: How to parse Microsoft Transact-SQL Statements in C# and to match the column aliases of a view
连接公司跳板机取别名
Basic knowledge learning record
Wechat applet communicates with esp8266 based on UDP protocol
Redis docker 安装
基于ibeacons签到系统
基於CM管理的CDH集群集成Phoenix
RobotFramework 之 文件上传和下载
腾讯根据ip解析地址
收藏博客贴
程序编译调试学习记录
jsp学习1
Switch usage (wechat applet)