Re: pthread_create returns error code 11

D

Drew Lawson

[First, I agree with asking the next question in the threading group.]
i have a code that uses pthread, but when i use pthread_create()
method it returns error code 11.

That would depend on what error 11 is. On my system, errno.h says:
#define EDEADLK 11 /* Resource deadlock avoided */
/* 11 was EAGAIN */

So, 11 once was EAGAIN, which is a known return for pthread_create().
It may still be on your implementation. My system's man page says:
The pthread_create() function will 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.

I have found out that this is often
because of exceeding the THREAD_MAX limit for the process. But i want
to use only about 24 threads at a given time, and i destroy the
threads (or atleast i thought so) can someone tell me what i am doing
wrong here it would be of great help! thanks!

My next guess is that your system won't allow a user process to run
24 (additional) threads. But most of what I can say about pthreads
is guesses. The experts in comp.programming.threads know this stuff
inside and out.
 
A

Antoninus Twink

That would depend on what error 11 is. On my system, errno.h says:
#define EDEADLK 11 /* Resource deadlock avoided */
/* 11 was EAGAIN */

So, 11 once was EAGAIN, which is a known return for pthread_create().
It may still be on your implementation.

It seems likely that it is, given the code that produced it.

Of course, he can find out for sure by passing the return value from
pthread_create() to strerror().
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,831
Latest member
RusselWill

Latest Threads

Top