Re: [xml] win32 thread safety patch



On Mon, Jan 07, 2002 at 04:24:09PM -0500, Serguei Narojnyi wrote:
included are two files that provide thread safety on win32.
threads.c.diff is a contextual diff against the cvs snapshot (from jan 01 i
believe) that is available on the xmlsoft.org site. testThreadsWin32.c is a
quick hack of original testThreads.c to make it work on win32. patch has
essentially two versions of thread safety, "universal" one and msvc specific
one. first one is pretty much a straightforward port of pthreads except for
TLS cleanup, which had to be done by utilising an extra helper thread that
is suspended until the main thread terminates after which it performs a
cleanup and exits itself (so essentially you have one extra sleeping thread
for each active one). second version makes use of __declspec (thread)
functionaly of msvc compiler and is much more simplier (and doesn't use any
extra threads) but unfortunatly wouldn't work on other compilers. you also
have to #define LIBXML_THREAD_ENABLED somewhere in xmlwin32version.h and
#define HAVE_WIN32_THREADS somewhere as well (win32config.h looks like a
good place). i urge people to test and provide comments on patch.
modifications to both files were done by me, Serguei Narojnyi.

  Well I can't comment on the Windows API specific aspects of your code,
looking at the thread.c patch this seems clean. It seems the activation
of the code needs to get a couple of defines set in the xmlwin32version.h
header, like HAVE_WIN32_THREADS and LIBXML_THREADS_ENABLED, this is minor.

  I'm tempted to include your code on the basis that it looks clean and that
adding it is probably the best way to get fixes fast if there is need for
fixes :-)

  I'm also wondering if this should be activated by default, we decided not
to do it on the Unix compilation, but if there is no noticeable overhead
on Windows this might be a good idea.
  What do the Windows users think ?

  Thanks a lot for your contribution !

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.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]