Hi (again), Livio Baldini Soares writes:
Hi Jorge,
I just got the chance to look at your little test program. It has a few bugs:
1) In pthread_create() you are passing a pointer to the unintialized thrdID[i] variable. Pthreads does not guarantee that the threadID argument is initialized before the start_routine is called. If you try printing the value of p_thrID in the 'thr_function', you'll see you'll get some correct and some random values.
I just looked and there are three occurences of this bug in Dillo: dpi/file.c src/IO/IO.c src/dns.c All three of them should have the current calls to: 'pthread_detach(uninitialized-variable)' changed to use 'pthread_detach(phtread_self())' As in all three cases the variable used has some likelihood (in my system, a high likelihood) of not yet being initialized. In some cases (like struct DnsServer) the threadID variable can optionally be altogether removed. The final patch is left as an exercise to the reader ;-) hope this helps, -- Livio B. Soares