为什么 pthread_create() 有时会在 Cygwin 端口上给出 EAGAIN?
当 pthread_create() 返回 errno 11 (EAGAIN)“资源暂时不可用”时,这意味着什么?
我正在将我的应用程序从它移植到 Cygwin,它在 Centos 4 上工作得很好。每隔一段时间,应用程序就会在调用 pthread_create() 时失败,但大多数时候它工作正常。
这意味着什么出错了?
Linux Centos 4 手册页说:
EAGAIN The system lacked the necessary resources to create another thread, or the system-imposed limit on the total number of threads in a process
{PTHREAD_THREADS_MAX} would be exceeded.
我怀疑我是否达到了 PTHREAD_THREADS_MAX,那么 Cygwin 系统怎么会耗尽资源来创建另一个线程呢?
What does it mean when pthread_create() returns errno 11 (EAGAIN), "Resource temporarily unavailable"?
I am porting my application to Cygwin from it working great on Centos 4. Every once in a while, the application fails in its call to pthread_create(), but most of the time it works fine.
What does this mean is going wrong?
The Linux Centos 4 man page says:
EAGAIN The system lacked the necessary resources to create another thread, or the system-imposed limit on the total number of threads in a process
{PTHREAD_THREADS_MAX} would be exceeded.
I doubt I am hitting PTHREAD_THREADS_MAX, so how could the Cygwin system run out of resources to create another thread?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
来自 pthread_create() 手册页:
如果出现以下情况,pthread_create() 函数将失败:
EAGAIN
系统缺乏创建另一个线程所需的资源,或者将超出系统对进程中线程总数 {PTHREAD_THREADS_MAX} 施加的限制。
您可以释放一些资源后重试。
From pthread_create() man page :
The pthread_create() function shall fail if:
EAGAIN
The system lacked the necessary resources to create another thread, or the system-imposed limit on the total number of threads in a process {PTHREAD_THREADS_MAX} would be exceeded.
You can try again, after releasing some resources.