diff -u /boot/home/Unzipped/libxml2/configure.in /BeStorage/Sources/Apps/My/LibPak/src_current/libxml2-2.6.1/configure.in --- /boot/home/Unzipped/libxml2/configure.in Wed Oct 29 00:06:30 2003 +++ /BeStorage/Sources/Apps/My/LibPak/src_current/libxml2-2.6.1/configure.in Sat Nov 1 22:37:10 2003 @@ -459,7 +459,7 @@ TEST_THREADS="" AC_ARG_WITH(threads, -[ --with-threads add multithread support(on)]) +[ --with-threads[[=TYPE]] add multithread support(on=pthread, set it =native to use platform specific support)]) if test "$with_minimum" = "yes" -a "$with_threads" = "" then with_threads=no @@ -469,12 +469,30 @@ else echo Enabling multithreaded support - AC_CHECK_HEADER(pthread.h, - AC_CHECK_LIB(pthread, pthread_join,[ - THREAD_LIBS="-lpthread" - AC_DEFINE([HAVE_LIBPTHREAD], [], [Define if pthread library is there (-lpthread)]) - AC_DEFINE([HAVE_PTHREAD_H], [], [Define if is there]) - WITH_THREADS="1"])) + if test "$with_threads" = "native" ; then + case "$host" in + *-*-beos) + AC_DEFINE([HAVE_BEOS_THREADS],1,[Use BeOS TLC and semaphore based xmlMutex]) + WITH_THREADS="1" + ;; + *-*-mingw*) + AC_DEFINE([HAVE_WIN32_THREADS],1,[Use Win32 multithread support]) + WITH_THREADS="1" + *) + echo "Native multithread is not supported on $host, trying pthread" + with_threads="pthread" + ;; + esac + fi + + if test "$with_threads" = "pthread" -o "$with_threads" = "yes" ; then + AC_CHECK_HEADER(pthread.h, + AC_CHECK_LIB(pthread, pthread_join,[ + THREAD_LIBS="-lpthread" + AC_DEFINE([HAVE_LIBPTHREAD], [], [Define if pthread library is there (-lpthread)]) + AC_DEFINE([HAVE_PTHREAD_H], [], [Define if is there]) + WITH_THREADS="1"])) + fi if test "$WITH_THREADS" = "1" ; then THREAD_CFLAGS="$THREAD_CFLAGS -D_REENTRANT" @@ -887,7 +905,16 @@ LIBS="${_libs}" LDFLAGS="${_ldflags}"])])) fi -M_LIBS="-lm" + +case "$host" in + *-*-beos) + M_LIBS="" + ;; + *) + M_LIBS="-lm" + ;; +esac + XML_LIBS="-lxml2 $Z_LIBS $THREAD_LIBS $ICONV_LIBS $M_LIBS $LIBS" XML_LIBTOOLLIBS="libxml2.la" AC_SUBST(WITH_ICONV) diff -u /boot/home/Unzipped/libxml2/nanohttp.c /BeStorage/Sources/Apps/My/LibPak/src_current/libxml2-2.6.1/nanohttp.c --- /boot/home/Unzipped/libxml2/nanohttp.c Wed Oct 29 14:39:15 2003 +++ /BeStorage/Sources/Apps/My/LibPak/src_current/libxml2-2.6.1/nanohttp.c Sat Nov 1 23:01:05 2003 @@ -909,6 +909,12 @@ status = ioctl(s, FIONBIO, &enable); } #else /* VMS */ +#if defined(__BEOS__) + { + int noblock = 1; + status = setsockopt(s, SOL_SOCKET, SO_NONBLOCK, &noblock, sizeof(noblock)); + } +#else /* __BEOS__ */ if ((status = fcntl(s, F_GETFL, 0)) != -1) { #ifdef O_NONBLOCK status |= O_NONBLOCK; @@ -927,6 +933,7 @@ closesocket(s); return(-1); } +#endif /* !__BEOS__ */ #endif /* !VMS */ #endif /* !_WINSOCKAPI_ */ diff -u /boot/home/Unzipped/libxml2/threads.c /BeStorage/Sources/Apps/My/LibPak/src_current/libxml2-2.6.1/threads.c --- /boot/home/Unzipped/libxml2/threads.c Wed Oct 29 14:39:15 2003 +++ /BeStorage/Sources/Apps/My/LibPak/src_current/libxml2-2.6.1/threads.c Sat Nov 1 00:27:20 2003 @@ -62,6 +62,7 @@ HANDLE mutex; #elif defined HAVE_BEOS_THREADS sem_id sem; + thread_id tid; #else int empty; #endif @@ -143,6 +144,7 @@ free(tok); return NULL; } + tok->tid = -1; #endif return (tok); } @@ -191,6 +193,7 @@ exit(); #endif } + tok->tid = find_thread(NULL); #endif } @@ -211,7 +214,10 @@ #elif defined HAVE_WIN32_THREADS ReleaseMutex(tok->mutex); #elif defined HAVE_BEOS_THREADS - release_sem(tok->sem); + if (tok->tid == find_thread(NULL)) { + tok->tid = -1; + release_sem(tok->sem); + } #endif } @@ -246,7 +252,6 @@ return NULL; } tok->count = 0; - tok->tid = 0; #endif return (tok); } @@ -303,12 +308,11 @@ EnterCriticalSection(&tok->cs); ++tok->count; #elif defined HAVE_BEOS_THREADS - if (tok->tid == find_thread(NULL)) { + if (tok->lock->tid == find_thread(NULL)) { tok->count++; return; } else { xmlMutexLock(tok->lock); - tok->tid = find_thread(NULL); tok->count = 1; } #endif @@ -338,10 +342,9 @@ if (!--tok->count) LeaveCriticalSection(&tok->cs); #elif defined HAVE_BEOS_THREADS - if (tok->tid == find_thread(NULL)) { + if (tok->lock->tid == find_thread(NULL)) { tok->count--; if (tok->count == 0) { - tok->tid = 0; xmlMutexUnlock(tok->lock); } return;