|
我在编写的一个多线程网络程序(我的系统是AIX),在创建线程时报错EAGAIN,我查了man page,里面对错误的描述是这样的
ERRORS
EAGAIN not enough system resources to create a process for the new
thread.
EAGAIN more than PTHREAD_THREADS_MAX threads are already active.
我又查了sys/limits.h PTHREAD_THREADS_MAX 值为512,并且我的程序里面没有动态分配内存,因此不大可能是进程的内存耗尽,
不知道还有没有其他限制导致线程无法创建,请各位指点,我的代码如下:
iRet=pthread_create(&tid,NULL,&Deal,(void *)&conninfo[iCurr]);
if(iRet!=0)
{
pthread_mutex_lock(&thread_flag);
conninfo[iCurr].iUsed=0;
m_Connects--;
pthread_mutex_unlock(&thread_flag);
WriteLOG("ERROR: create thread failure,code=%d\n",iRet);
resp_ptr->cResult = SYSTEM_ERR;
}
else
{
resp_ptr->cResult = 0;
} |
|