您当前的位置: 首页 >  c++

命运之手

暂无认证

  • 1浏览

    0关注

    747博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

【C++】【开发琐事】pthread_create啥也不干也会崩溃

命运之手 发布时间:2021-07-15 10:49:59 ,浏览量:1

说来惭愧,pthread_create是要返回void*的,这里忘写return了

由于编译器没有提示,报错也没提示具体原因,所以自己想了半天才想出来

记录一下,相信会有很多人犯一样的错误,特别在编译器没错误提示的情况下,经常忘记return


	//开启解码线程
	pthread_create(&pidDecode, nullptr, [](void *args) -> void * {
	    //AudioChannel *audioChannel = static_cast (args);
	    //audioChannel->_decode();
	}, this);


	//开启解码线程
	pthread_create(&pidDecode, nullptr, [](void *args) -> void * {
	    //AudioChannel *audioChannel = static_cast (args);
	    //audioChannel->_decode();
	    return nullptr;
	}, this);

关注
打赏
1654938663
查看更多评论
立即登录/注册

微信扫码登录

0.0387s