Re: [xml] Clarification regarding Same Null checks in xmlInitThreads(Threads.c)

On Fri, Oct 19, 2007 at 03:11:02PM +0530, Ashwin wrote:

On Fri, Oct 19, 2007 at 11:12:49AM +0530, Ashwin wrote:


       In  the function xmlInitThreads present in the threads .c file the
   null check for pthread_key_create is present twice on line numbers 810
   and 818(version 28). Is this an oversight?

 oversight definitely, note though that there is no pthread_key_delete
test, i.e. we don't free the data (which caused some toubles in amd
the automounter recently where libxml2 was dlopen'ed). But that's a
different (and quite complex) issue.
In the same function null checks are not present for pthread_cond_destroy
and pthread_cond_wait. Is this by design? 
Plus right at the beginning there are two extern declarations for
pthread_key_create one with parameters and another without, maybe that's how
it works but I am not sure

  The fact taht the test is double is absolutely no problem.
For the general principle of those tests,i
     1/ it's to avoid forcing linking to -lpthread by libxml2 while
        using it if the final application uses it
     2/ it uses ELF weak references

it's not simple, depends on the ELF format and compiler specifics.


Red Hat Virtualization group
Daniel Veillard      | virtualization library
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]