Re: [xml] libxml2 and pthreads



On Thu, Aug 19, 2004 at 12:57:31PM -0700, Ben Greear wrote:
Daniel Veillard wrote:
On Thu, Aug 19, 2004 at 12:32:29PM -0700, Ben Greear wrote:

I do not have to link libpthread for normal malloc and free though,
and when I fork() from a signal handler my program doesn't deadlock
deep in libpthread :)


 Doing anything complex in a signal handler will bite you hard anyway
sooner or later. Advice : don't do this...

Yep...it's just code to write out the last bit of debugging info
before abort().

Anyway, I've seen other libraries that allowed one to set the lock
callback methods at run-time.  Something like:
xmlSetLock(int my_lock_method(), void* myData, xmlFoo 
xml_thing_that_needs_a_lock);

  That would force existing threaded apps using libxml2 to change
their initialization code, basically an API/ABI break. Impossible at this
point, sorry !

If you did something like that, then there would be no pthread dependency,
but those that are running multi-threaded apps can provide their own locking
primitives (based off of libpthread or their threading package of choice).

  There is an alternative, at least on Linux/gcc but Jakub never provided
the patch or information on how to really do so:

  https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=115806

Daniel

-- 
Daniel Veillard      | Red Hat Desktop team http://redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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