gpt4 book ai didi

c++ - 如何验证 pthread 函数是否开始执行

转载 作者:太空宇宙 更新时间:2023-11-04 14:45:17 25 4
gpt4 key购买 nike

例子:

void start(void){   pthread_create(&threadID, Null, run_thread_function,arguments);   //is there a way to ensure if the run_thread_function(basically new thread) started      //execution before returning from this(start) function    }

最佳答案

检查返回码。

if ((retcode = pthread_create(&threadID, Null, run_thread_function,arguments)) != 0)
{
//something went wrong
}

关于c++ - 如何验证 pthread 函数是否开始执行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13167318/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com