]> granicus.if.org Git - imagemagick/blobdiff - MagickCore/semaphore-private.h
(no commit message)
[imagemagick] / MagickCore / semaphore-private.h
index 71558f30c1d17e5054af2bcae416b023409dd155..182cfc8191197a5ee28c7374499a568d84236685 100644 (file)
@@ -42,6 +42,27 @@ static ssize_t
   semaphore_mutex = 0;
 #endif
 
+static MagickBooleanType
+  active_mutex = MagickFalse;
+
+static inline void DestroyMagickMutex(void)
+{
+#if defined(MAGICKCORE_OPENMP_SUPPORT)
+  if (active_mutex != MagickFalse)
+    omp_destroy_lock(&semaphore_mutex);
+#endif
+  active_mutex=MagickFalse;
+}
+
+static inline void InitializeMagickMutex(void)
+{
+#if defined(MAGICKCORE_OPENMP_SUPPORT)
+  if (active_mutex == MagickFalse)
+    omp_init_lock(&semaphore_mutex);
+#endif
+  active_mutex=MagickTrue;
+}
+
 static inline void LockMagickMutex(void)
 {
 #if defined(MAGICKCORE_OPENMP_SUPPORT)