--- src/xercesc/runConfigure.dist Fri Dec 27 10:26:26 2002 +++ src/xercesc/runConfigure Fri Dec 27 10:56:18 2002 @@ -189,6 +189,7 @@ linkeroptions="$linkeroptions $2"; shift 2;; -P) + prefix=$2 configureoptions="$configureoptions --prefix=$2"; shift 2;; -C) @@ -301,8 +302,16 @@ ;; esac elif test $platform = "freebsd"; then - threadingLibs="-pthread -lc_r" - threadingDefines="-D_THREAD_SAFE -DXML_USE_PTHREADS" + case $thread in + pth) + threadingLibs="-L$prefix/lib -lpth -lc_r" + threadingDefines="-D_THREAD_SAFE -DXML_USE_PTHREADS -DUSE_PTH -I$prefix/include" + ;; + *) + threadingLibs="-pthread -lc_r" + threadingDefines="-D_THREAD_SAFE -DXML_USE_PTHREADS" + ;; + esac elif test $platform = "aix"; then aix_version=`./config.guess`; echo Found host system to be $aix_version --- src/xercesc/util/Platforms/FreeBSD/FreeBSDPlatformUtils.cpp.dist Tue Aug 27 09:24:36 2002 +++ src/xercesc/util/Platforms/FreeBSD/FreeBSDPlatformUtils.cpp Fri Dec 27 10:35:29 2002 @@ -86,8 +86,12 @@ // --------------------------------------------------------------------------- #if !defined(APP_NO_THREADS) +#ifdef USE_PTH +#include +#else #include #endif +#endif #ifndef _GNU_SOURCE #error _GNU_SOURCE is not defined in your compile settings @@ -584,6 +588,14 @@ void* XMLPlatformUtils::makeMutex() { +#ifdef USE_PTH + pth_mutex_t* mutex = new pth_mutex_t; + if (pth_mutex_init(mutex)) + { + ThrowXML(XMLPlatformUtilsException, + XMLExcepts::Mutex_CouldNotCreate); + } +#else pthread_mutex_t* mutex = new pthread_mutex_t; pthread_mutexattr_t* attr = new pthread_mutexattr_t; pthread_mutexattr_init(attr); @@ -595,20 +607,24 @@ } pthread_mutexattr_destroy(attr); delete attr; +#endif return (void*)(mutex); - } void XMLPlatformUtils::closeMutex(void* const mtxHandle) { if (mtxHandle != NULL) { +#ifdef USE_PTH + delete (pth_mutex_t*)mtxHandle; +#else if (pthread_mutex_destroy((pthread_mutex_t*) mtxHandle)) { ThrowXML(XMLPlatformUtilsException, XMLExcepts::Mutex_CouldNotDestroy); } delete (pthread_mutex_t*)mtxHandle; +#endif } } @@ -617,7 +633,11 @@ { if (mtxHandle != NULL) { +#ifdef USE_PTH + if (pth_mutex_acquire((pth_mutex_t*) mtxHandle, FALSE, NULL)) +#else if (pthread_mutex_lock((pthread_mutex_t*) mtxHandle)) +#endif { ThrowXML(XMLPlatformUtilsException, XMLExcepts::Mutex_CouldNotLock); @@ -630,7 +650,11 @@ { if (mtxHandle != NULL) { +#ifdef USE_PTH + if (pth_mutex_release((pth_mutex_t*) mtxHandle)) +#else if (pthread_mutex_unlock((pthread_mutex_t*) mtxHandle)) +#endif { ThrowXML(XMLPlatformUtilsException, XMLExcepts::Mutex_CouldNotUnlock);