成员函数做 线程函数, 认不出 参数 ,“(nil)” ?

shouso888 shouso888 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
void* SomeClass::NoneStaticThreadFunc(void* param)
{
printf("param=[%p],this=[%p] \n", param, this);
return NULL;
}

void SomeClass::InvokNoneStaticThreadFunc()
{
pthread_t tid;
pthread_create(&tid, NULL, (void* (*) (void*))&SomeClass::NoneStaticThreadFunc, this);
}

打印结果: param=[(nil)], this=[0x7fff44cae060].

为什么打印 param 是 “(nil)” ???
...全文
评论 4
收藏 已收藏
分享
返回顶部
shouso888
Linux/Unix社区 23,224 成员 74,535 内容