[xml] win32 thread safety patch

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.

Attachment: threads.c.diff
Description: Binary data

Attachment: testThreadsWin32.c
Description: Text document

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