Hi, 
  I got the following problem with localtime() when I create 10 thread. The
main problem is also attached. 
However, if I create 2 or 3 thread, it works fine.
  Any clue.
  Thanks.


Program received signal SIGSEGV, Segmentation fault.
0x40953709 in chunk_alloc (ar_ptr=0x409e8d60, nb=24) at malloc.c:2763
2763    malloc.c: No such file or directory.
(gdb) bt
#0  0x40953709 in chunk_alloc (ar_ptr=0x409e8d60, nb=24) at malloc.c:2763
#1  0x409535ce in __libc_malloc (bytes=15) at malloc.c:2696
#2  0x40958a29 in __strdup (s=0x409e1731 "/etc/localtime") at strdup.c:43
#3  0x409833c0 in tzset_internal (always=24) at tzset.c:169
#4  0x409840db in __tz_convert (timer=0xbffff834, use_localtime=1,
tp=0x409ee460) at tzset.c:582
#5  0x4097fc9c in localtime (t=0xbffff834) at localtime.c:43
#6  0x8057d61 in main (argc=3, argv=0xbffff8c4) at testt.c:75
(gdb) 

testt.c
int main() 
{
        struct timeb start, end;
        struct tm *ploc_t0;
        struct tm *ploc_t1;

        ftime(&start);
        
        for (i=0; i<threads; i++)
        {
          //create 10 threads.
        }

        for (i=0; i<threads; i++)
        {       
           pthread_join(t[i], 0);
        }
        
        ftime(&end);
        ploc_t0 = localtime(&start.time);
        ploc_t1 = localtime(&end.time);
        ...
}



_______________________________________________
Redhat-devel-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-devel-list

Reply via email to