diff --git a/MagickCore/fx.c b/MagickCore/fx.c
index 6cd1861..808f8e3 100644
--- a/MagickCore/fx.c
+++ b/MagickCore/fx.c
@@ -82,6 +82,7 @@
#include "MagickCore/resample.h"
#include "MagickCore/resample-private.h"
#include "MagickCore/resize.h"
+#include "MagickCore/resource_.h"
#include "MagickCore/splay-tree.h"
#include "MagickCore/statistic.h"
#include "MagickCore/string_.h"
@@ -269,7 +270,6 @@
*noise_image;
MagickBooleanType
- concurrent,
status;
MagickOffsetType
@@ -281,6 +281,9 @@
ssize_t
y;
+ unsigned long
+ key;
+
/*
Initialize noise image attributes.
*/
@@ -304,12 +307,12 @@
status=MagickTrue;
progress=0;
random_info=AcquireRandomInfoThreadSet();
- concurrent=GetRandomSecretKey(random_info[0]) == ~0UL ? MagickTrue :
- MagickFalse;
image_view=AcquireVirtualCacheView(image,exception);
noise_view=AcquireAuthenticCacheView(noise_image,exception);
+ key=GetRandomSecretKey(random_info[0]);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(progress,status) omp_concurrent(concurrent)
+ #pragma omp parallel for schedule(static,4) shared(progress,status) \
+ if (key == ~0UL) num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
@@ -4401,7 +4404,6 @@
*sketch_image;
MagickBooleanType
- concurrent,
status;
RandomInfo
@@ -4410,6 +4412,9 @@
ssize_t
y;
+ unsigned long
+ key;
+
/*
Sketch image.
*/
@@ -4419,11 +4424,11 @@
return((Image *) NULL);
status=MagickTrue;
random_info=AcquireRandomInfoThreadSet();
- concurrent=GetRandomSecretKey(random_info[0]) == ~0UL ? MagickTrue :
- MagickFalse;
+ key=GetRandomSecretKey(random_info[0]);
random_view=AcquireAuthenticCacheView(random_image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
- #pragma omp parallel for schedule(static,4) shared(status) omp_concurrent(concurrent)
+ #pragma omp parallel for schedule(static,4) shared(status) \
+ if (key == ~0UL) num_threads(GetMagickResourceLimit(ThreadResource))
#endif
for (y=0; y < (ssize_t) random_image->rows; y++)
{