- 论坛徽章:
- 0
|
看看 manual 吧:
RETURN VALUE
On success, pthread_create() returns 0; on error, it returns an error number, and the contents of *thread are undefined.
ERRORS
EAGAIN Insufficient resources to create another thread, or a system-imposed limit on the number of threads was encountered.
The latter case may occur in two ways: the RLIMIT_NPROC soft resource limit (set via setrlimit(2)), which limits the
number of process for a real user ID, was reached; or the kernel’s system-wide limit on the number of threads,
/proc/sys/kernel/threads-max, was reached.
EINVAL Invalid settings in attr.
EPERM No permission to set the scheduling policy and parameters specified in attr.
错误的时候返回的是错误的值,而不是把错误的值写在errno中。
所以不能用 perror 来看错误,你要把nRet的值打印出来,根据这个值去分析错误。 |
|