]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Tue, 21 Jan 2014 01:57:10 +0000 (01:57 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Tue, 21 Jan 2014 01:57:10 +0000 (01:57 +0000)
MagickCore/semaphore-private.h
MagickCore/semaphore.c

index 5daa2153bae2333a88d03d4f81a122010918b626..71558f30c1d17e5054af2bcae416b023409dd155 100644 (file)
@@ -28,7 +28,10 @@ extern MagickPrivate MagickBooleanType
 extern MagickPrivate void
   SemaphoreComponentTerminus(void);
 
-#if defined(MAGICKCORE_THREAD_SUPPORT)
+#if defined(MAGICKCORE_OPENMP_SUPPORT)
+static omp_lock_t
+  semaphore_mutex;
+#elif defined(MAGICKCORE_THREAD_SUPPORT)
 static pthread_mutex_t
   semaphore_mutex = PTHREAD_MUTEX_INITIALIZER;
 #elif defined(MAGICKCORE_HAVE_WINTHREADS)
@@ -41,7 +44,9 @@ static ssize_t
 
 static inline void LockMagickMutex(void)
 {
-#if defined(MAGICKCORE_THREAD_SUPPORT)
+#if defined(MAGICKCORE_OPENMP_SUPPORT)
+  omp_set_lock(&semaphore_mutex);
+#elif defined(MAGICKCORE_THREAD_SUPPORT)
   {
     int
       status;
@@ -61,7 +66,9 @@ static inline void LockMagickMutex(void)
 
 static inline void UnlockMagickMutex(void)
 {
-#if defined(MAGICKCORE_THREAD_SUPPORT)
+#if defined(MAGICKCORE_OPENMP_SUPPORT)
+  omp_unset_lock(&semaphore_mutex);
+#elif defined(MAGICKCORE_THREAD_SUPPORT)
   {
     int
       status;
index 02968ad809aaac7fedf236b4011bd1446cd0c349..c25d294aa4cff562a584085ace897fe42cbf5cff 100644 (file)
@@ -202,7 +202,9 @@ MagickExport SemaphoreInfo *AllocateSemaphoreInfo(void)
   /*
     Initialize the semaphore.
   */
-#if defined(MAGICKCORE_THREAD_SUPPORT)
+#if defined(MAGICKCORE_OPENMP_SUPPORT)
+  omp_init_lock((omp_lock_t *) &semaphore_info->mutex);
+#elif defined(MAGICKCORE_THREAD_SUPPORT)
   {
     int
       status;
@@ -291,7 +293,9 @@ MagickExport void DestroySemaphoreInfo(SemaphoreInfo **semaphore_info)
   assert((*semaphore_info) != (SemaphoreInfo *) NULL);
   assert((*semaphore_info)->signature == MagickSignature);
   LockMagickMutex();
-#if defined(MAGICKCORE_THREAD_SUPPORT)
+#if defined(MAGICKCORE_OPENMP_SUPPORT)
+  omp_destroy_lock((omp_lock_t *) &(*semaphore_info)->mutex);
+#elif defined(MAGICKCORE_THREAD_SUPPORT)
   {
     int
       status;
@@ -338,7 +342,9 @@ MagickExport void LockSemaphoreInfo(SemaphoreInfo *semaphore_info)
 {
   assert(semaphore_info != (SemaphoreInfo *) NULL);
   assert(semaphore_info->signature == MagickSignature);
-#if defined(MAGICKCORE_THREAD_SUPPORT)
+#if defined(MAGICKCORE_OPENMP_SUPPORT)
+  omp_set_lock((omp_lock_t *) &semaphore_info->mutex);
+#elif defined(MAGICKCORE_THREAD_SUPPORT)
   {
     int
       status;
@@ -479,7 +485,9 @@ MagickExport void UnlockSemaphoreInfo(SemaphoreInfo *semaphore_info)
     }
   semaphore_info->reference_count--;
 #endif
-#if defined(MAGICKCORE_THREAD_SUPPORT)
+#if defined(MAGICKCORE_OPENMP_SUPPORT)
+  omp_unset_lock((omp_lock_t *) &semaphore_info->mutex);
+#elif defined(MAGICKCORE_THREAD_SUPPORT)
   {
     int
       status;