This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Backtrace doesn't terminate.


Hi,
	Thanks for replying. I have attached the testcase and the gdb output.

Regards,
-Girish.

Attachment: bt-log
Description: Text document

#include <pthread.h>

#define THR_NUMS 10
#define MAX_THR 512

void *func(void *num)
{
    int i, j, l, m;

    sleep(1);
    for(i=1;i<10;i++)
      {
	for(j=1;j<10;j++)
	  {
	    l = l+j;	    
	  }
      }
}

int main()
{
    int i, thr_nums;
    pthread_t thr[MAX_THR];

    thr_nums = THR_NUMS;    
    for(i=0;i<thr_nums; i++)
      {
	if ( pthread_create (&(thr[i]), NULL, func, &i ) != 0 )
                            perror("Thread creation failed");
      }

    for (i=0;i<thr_nums;i++)    
      {
	    pthread_join( thr[i], NULL);
      }
    return 0;
}
    
    

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]