xerces-c-pth.patch 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. --- src/xercesc/runConfigure.dist Fri Dec 27 10:26:26 2002
  2. +++ src/xercesc/runConfigure Fri Dec 27 10:56:18 2002
  3. @@ -189,6 +189,7 @@
  4. linkeroptions="$linkeroptions $2"; shift 2;;
  5. -P)
  6. + prefix=$2
  7. configureoptions="$configureoptions --prefix=$2"; shift 2;;
  8. -C)
  9. @@ -301,8 +302,16 @@
  10. ;;
  11. esac
  12. elif test $platform = "freebsd"; then
  13. - threadingLibs="-pthread -lc_r"
  14. - threadingDefines="-D_THREAD_SAFE -DXML_USE_PTHREADS"
  15. + case $thread in
  16. + pth)
  17. + threadingLibs="-L$prefix/lib -lpth -lc_r"
  18. + threadingDefines="-D_THREAD_SAFE -DXML_USE_PTHREADS -DUSE_PTH -I$prefix/include"
  19. + ;;
  20. + *)
  21. + threadingLibs="-pthread -lc_r"
  22. + threadingDefines="-D_THREAD_SAFE -DXML_USE_PTHREADS"
  23. + ;;
  24. + esac
  25. elif test $platform = "aix"; then
  26. aix_version=`./config.guess`;
  27. echo Found host system to be $aix_version
  28. --- src/xercesc/util/Platforms/FreeBSD/FreeBSDPlatformUtils.cpp.dist Tue Aug 27 09:24:36 2002
  29. +++ src/xercesc/util/Platforms/FreeBSD/FreeBSDPlatformUtils.cpp Fri Dec 27 10:35:29 2002
  30. @@ -86,8 +86,12 @@
  31. // ---------------------------------------------------------------------------
  32. #if !defined(APP_NO_THREADS)
  33. +#ifdef USE_PTH
  34. +#include <pth.h>
  35. +#else
  36. #include <pthread.h>
  37. #endif
  38. +#endif
  39. #ifndef _GNU_SOURCE
  40. #error _GNU_SOURCE is not defined in your compile settings
  41. @@ -584,6 +588,14 @@
  42. void* XMLPlatformUtils::makeMutex()
  43. {
  44. +#ifdef USE_PTH
  45. + pth_mutex_t* mutex = new pth_mutex_t;
  46. + if (pth_mutex_init(mutex))
  47. + {
  48. + ThrowXML(XMLPlatformUtilsException,
  49. + XMLExcepts::Mutex_CouldNotCreate);
  50. + }
  51. +#else
  52. pthread_mutex_t* mutex = new pthread_mutex_t;
  53. pthread_mutexattr_t* attr = new pthread_mutexattr_t;
  54. pthread_mutexattr_init(attr);
  55. @@ -595,20 +607,24 @@
  56. }
  57. pthread_mutexattr_destroy(attr);
  58. delete attr;
  59. +#endif
  60. return (void*)(mutex);
  61. -
  62. }
  63. void XMLPlatformUtils::closeMutex(void* const mtxHandle)
  64. {
  65. if (mtxHandle != NULL)
  66. {
  67. +#ifdef USE_PTH
  68. + delete (pth_mutex_t*)mtxHandle;
  69. +#else
  70. if (pthread_mutex_destroy((pthread_mutex_t*) mtxHandle))
  71. {
  72. ThrowXML(XMLPlatformUtilsException,
  73. XMLExcepts::Mutex_CouldNotDestroy);
  74. }
  75. delete (pthread_mutex_t*)mtxHandle;
  76. +#endif
  77. }
  78. }
  79. @@ -617,7 +633,11 @@
  80. {
  81. if (mtxHandle != NULL)
  82. {
  83. +#ifdef USE_PTH
  84. + if (pth_mutex_acquire((pth_mutex_t*) mtxHandle, FALSE, NULL))
  85. +#else
  86. if (pthread_mutex_lock((pthread_mutex_t*) mtxHandle))
  87. +#endif
  88. {
  89. ThrowXML(XMLPlatformUtilsException,
  90. XMLExcepts::Mutex_CouldNotLock);
  91. @@ -630,7 +650,11 @@
  92. {
  93. if (mtxHandle != NULL)
  94. {
  95. +#ifdef USE_PTH
  96. + if (pth_mutex_release((pth_mutex_t*) mtxHandle))
  97. +#else
  98. if (pthread_mutex_unlock((pthread_mutex_t*) mtxHandle))
  99. +#endif
  100. {
  101. ThrowXML(XMLPlatformUtilsException,
  102. XMLExcepts::Mutex_CouldNotUnlock);