pthread_create的默认栈大小为什么是8M

来源,java创建新线程启动jvm的时候

ContinueInNewThread0(int (JNICALL *continuation)(void *), jlong stack_size, void * args) 

在没有设置-Xss的时候pthread在linux平台上的默认栈大小是多少

pthread_create(&tid, &attr, (void *(*)(void*))continuation, (void*)args)

然后会调用

__pthread_create_2_1函数,这是为什么呢

是因为这个宏的原因  给pthread_create和__pthread_create_2_1牵线搭桥的

versioned_symbol (libpthread, __pthread_create_2_1, pthread_create, GLIBC_2_1);

/* That header also defines symbols like `VERSION_libm_GLIBC_2_1' to

the version set name to use for e.g. symbols first introduced into

libm in the GLIBC_2.1 version. Definitions of symbols with explicit

versions should look like:

versioned_symbol (libm, new_foo, foo, GLIBC_2_1);

This will define the symbol `foo' with the appropriate default version,

i.e. either GLIBC_2.1 or the "earliest version" specified in

shlib-versions if that is newer. */

# define versioned_symbol(lib, local, symbol, version) \

versioned_symbol_1 (lib, local, symbol, version)

# define versioned_symbol_1(lib, local, symbol, version) \

versioned_symbol_2 (local, symbol, VERSION_##lib##_##version)

# define versioned_symbol_2(local, symbol, name) \

default_symbol_version (local, symbol, name)

# define default_symbol_version(real, name, version) \

_default_symbol_version(real, name, version)

# define _symbol_version(real, name, version) \

.symver real, name##@##version

展开后是这样子的

.symver __pthread_create_2_1, pthread_create@GLIBC_2_1

把关注点放到__pthr

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

半块橘子

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值