pthread_create空间不足 [英] pthread_create not enough space
本文介绍了pthread_create空间不足的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Windows上的MinGW中使用Pthreads.调用pthread_create返回一个错误,该错误翻译为空间不足".它指的是哪种空间?是线程堆栈空间吗?
I'm using Pthreads with MinGW on Windows. A call to pthread_create returns a error which translates to "Not enough space". What kind of space does it refer to? Is the thread stack space?
int scannerThreadReturnValue = pthread_create(&parserThreadHandle, &attr, parserThread, (void *)filename);
if(scannerThreadReturnValue != 0) {
printf("Unable to create thread %s\n", strerror(errno));
}
else printf("Parser thread creation successfull\n");
推荐答案
错误消息很可能是错误的,因为pthread_*
函数家族未设置errno
.错误代码由函数返回.
The error message most propably is wrong, as the pthread_*
family of functions does not set errno
. The error code is returned by the functions.
因此,您对代码的编码如下:
So mod you code like this:
int scannerThreadReturnValue = pthread_create(&parserThreadHandle, &attr, parserThread, (void*)filename);
if (scannerThreadReturnValue != 0)
{
printf("Unable to create thread: %s\n", strerror(scannerThreadReturnValue));
}
else
{
printf("Parser thread creation successful.\n");
}
这将为您提供正确的错误消息.
This will give you the correct error message.
这篇关于pthread_create空间不足的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文