gdb 4.18 on RedHat 6.2 does not seem to handle exiting threads
properly, causing it to run out of threads when many short-lived
threads are started in succession.  Are there any known patches or
solutions to this problem?

The following program illustrates the problem.  It runs fine without
gdb, but rapidly runs out of threads under gdb.

#include <pthread.h>
#include <stdio.h>

void *do_thread(void *arg)
{
  return NULL;
}

int main(int argc, char **argv)
{
  int i;
  pthread_t ptid;
  for (i = 0; i < 1024; i++)
    if (pthread_create(&ptid, NULL, do_thread, NULL))
      fprintf(stderr, "Couldn't start thread #%d\n", i);
    else
      if (pthread_join(ptid, NULL))
        fprintf(stderr, "Couldn't join thread #%d\n", i);
                
}

-- 
 '-------------------  Markus Bjartveit Krüger  ---------------------`
'                                                                     `
` E-mail: [EMAIL PROTECTED]           WWW: http://www.pvv.org/~markusk/ '
 )-------------------------------------------------------------------(

Reply via email to