Page 1 of 1

Setting thread limit = 1 programmatically in Magick++

Posted: 2015-07-15T12:13:34-07:00
by vigri
Hello,

when I want to "disable" OpenMP while using the convert command I simply use

Code: Select all

convert -limit thread 1 in.png out.jpg
Now I've a C++ program where I'm using the Magick++ API.

My question: Is there a way to limit the maximum thread amount programmatically?

I know about setting MAGICK_THREAD_LIMIT=1 in /etc/Environment - but I would like to set the limit in my code.

Best regards.

Re: Setting thread limit = 1 programmatically in Magick++

Posted: 2015-07-15T14:24:19-07:00
by dlemstra
If you have a new version of ImageMagick you can do this with the ResourceLimits class.

Re: Setting thread limit = 1 programmatically in Magick++

Posted: 2015-07-15T15:10:30-07:00
by vigri
Hello,

thanks for your reply.
Can you give me please a little bit more Information?

I'm using IM 6.9.1

Best regards

Re: Setting thread limit = 1 programmatically in Magick++

Posted: 2015-08-28T19:41:18-07:00
by olear
Magick::ResourceLimits::thread(X);