开发者

Why does pthread_create() sometimes give EAGAIN on Cygwin port?

开发者 https://www.devze.com 2023-02-15 04:50 出处:网络
What does it mean when pthread_create() returns 开发者_JAVA百科errno 11 (EAGAIN), \"Resource temporarily unavailable\"?

What does it mean when pthread_create() returns 开发者_JAVA百科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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消