pthread_create源码解析

libc 库中 pthread_create  通过层层封装,最终通过调用clone 系统调用创建线程。

libc 代码中:


pthread_create.c中,

函数调用关系 __pthread_create_2_1 -》create_thread-》do_clone


create_thread 函数传递给do_clone 的flag 为 

/* We rely heavily on various flags the CLONE function understands:


     CLONE_VM (共享内存描述符和所有页表), CLONE_FS (共享根目录和当前工作目录所在的表,以及用于屏蔽新文件许可权的位掩码值), CLONE_FILES(共享打开文件表)
These flags select semantics with shared address space and
file descriptors according to what POSIX requires.


     CLONE_SIGNAL
This flag selects the POSIX signal semantics.


     CLONE_SETTLS
The sixth parameter to CLONE determines the TLS area for the

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值