Re: pthread_create returns error code 11

Discussion in 'C Programming' started by Drew Lawson, May 27, 2009.

  1. Drew Lawson

    Drew Lawson Guest

    In article <>
    Harshith <> writes:

    [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.


    --
    Drew Lawson Some men's dreams
    for others turn to nightmares.
    I never would have thought this
    in my wildest dreams.
    Drew Lawson, May 27, 2009
    #1
    1. Advertising

  2. On 27 May 2009 at 16:51, Drew Lawson wrote:
    > Harshith <> writes:
    >>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.


    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().
    Antoninus Twink, May 28, 2009
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. vertigo

    pthread_create for class ?

    vertigo, Aug 28, 2004, in forum: Java
    Replies:
    4
    Views:
    969
    Tor Iver Wilhelmsen
    Aug 29, 2004
  2. nightowl
    Replies:
    1
    Views:
    2,169
    Ron Natalie
    Oct 21, 2004
  3. Gary Wessle

    pthread_create error

    Gary Wessle, Oct 21, 2006, in forum: C++
    Replies:
    9
    Views:
    1,027
    Larry Smith
    Oct 21, 2006
  4. Joy
    Replies:
    1
    Views:
    2,870
    Bart van Ingen Schenau
    May 27, 2009
  5. Keith Thompson

    Re: pthread_create returns error code 11

    Keith Thompson, May 27, 2009, in forum: C Programming
    Replies:
    10
    Views:
    937
    Chris M. Thomasson
    May 31, 2009
Loading...

Share This Page