Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/67.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C 在main()中加入pthread_之后退出pthread_是否有好处?_C - Fatal编程技术网

C 在main()中加入pthread_之后退出pthread_是否有好处?

C 在main()中加入pthread_之后退出pthread_是否有好处?,c,C,请参见上面链接中的代码 在main()中加入pthread_之后退出pthread_有什么好处吗 从的POSIX规范来看,使用pthread\u exit()而不是exit()或\u exit()或return没有多大好处。名义上,这意味着未执行atexit()处理程序,也可能意味着未刷新文件流-更像是\u exit()。在示例代码的上下文中,它似乎是不必要的。从中,似乎pthread\u exit立即终止调用线程,因此在main中,它相当于返回。

请参见上面链接中的代码

  • 在main()中加入pthread_之后退出pthread_有什么好处吗

  • 从的POSIX规范来看,使用
    pthread\u exit()
    而不是
    exit()
    \u exit()
    return
    没有多大好处。名义上,这意味着未执行
    atexit()
    处理程序,也可能意味着未刷新文件流-更像是
    \u exit()
    。在示例代码的上下文中,它似乎是不必要的。

    从中,似乎
    pthread\u exit
    立即终止调用线程,因此在
    main
    中,它相当于
    返回。