c/c++语言开发共享pthread_create没有足够的空间

我在Windows上使用Pthreads和MinGW。 对pthread_create的调用返回一个错误,该错误转换为“空间不足”。 它指的是什么样的空间? 是线程堆栈空间吗?

int scannerThreadReturnValue = pthread_create(&parserThreadHandle, &attr, parserThread, (void *)filename); if(scannerThreadReturnValue != 0) { printf("Unable to create thread %sn", strerror(errno)); } else printf("Parser thread creation successfulln"); 

    错误消息最可能是错误的,因为pthread_*系列函数没有设置errno 。 函数返回错误代码。

    所以修改你这样的代码:

     int scannerThreadReturnValue = pthread_create(&parserThreadHandle, &attr, parserThread, (void*)filename); if (scannerThreadReturnValue != 0) { printf("Unable to create thread: %sn", strerror(scannerThreadReturnValue)); } else { printf("Parser thread creation successful.n"); } 

    这将为您提供正确的错误消息。

    这很奇怪,虽然我不确定MinGW,是的,它应该指的是堆栈大小。 这是什么类型的应用程序? 你在这个parserThread之前创建了很multithreading吗? 。 理想情况下不应该在太空问题上失败。

    可能你可以启动线程属性,并尝试在创建线程之前设置stacksize。 所以我们可以轻松缩小范围。

      以上就是c/c++开发分享pthread_create没有足够的空间相关内容,想了解更多C/C++开发(异常处理)及C/C++游戏开发关注计算机技术网(www.ctvol.com)!)。

      本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。

      ctvol管理联系方式QQ:251552304

      本文章地址:https://www.ctvol.com/c-cdevelopment/518985.html

      (0)
      上一篇 2020年12月5日
      下一篇 2020年12月5日

      精彩推荐