pthread_detach(pthread_self())

将状态改为unjoinable状态,确保资源的释放。其实简单的说就是在线程函数头加上 pthread_detach(pthread_self())的话,线程状态改变,在函数尾部直接 pthread_exit线程就会自动退出。省去了给线程擦屁股的麻烦

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-30
  • 2022-12-23
  • 2022-12-23
  • 2021-11-26
猜你喜欢
  • 2022-12-23
  • 2021-11-19
  • 2021-06-14
  • 2022-12-23
  • 2021-10-16
  • 2022-01-07
相关资源
相似解决方案