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.
精彩评论