Page 1 of 1

MagickWand and Threading

Posted: 2010-12-13T13:56:49-07:00
by NitroPye
I'm doing a bunch of image processing in a GUI application so processing the images in a background thread is ideal but I've come up against an issue.

MagickReadImage, MagickWriteImage, and MagickResizeImage all cause a EXC_BAD_ACCESS in the background. MagickGetImageWidth, MagickSetImageResolution and a handful of other functions do not cause any issues in the background. The immediete solution was to call the offending functions on the main thread and wait until they are done but this is less than ideal as it locks up the UI.

I guess my first question would be is are the functions I am having issues with even usable in background threads?

If any more detailed information is needed from the debugger let me know.

Thanks in advance.

Re: MagickWand and Threading

Posted: 2010-12-13T17:42:22-07:00
by magick
Which version of ImageMagick are you using? Try building ImageMagick without OpenMP support, add --disable-openmp to your configure script command line and rebuild / reinstall. If it still fails, we'll need a small program we can download and reproduce the problem before we can comment further. ImageMagick is designed and tested to be thread safe but perhaps your program creates a condition we have not tested yet.

Re: MagickWand and Threading

Posted: 2010-12-13T18:05:38-07:00
by NitroPye
I am running version 6.6.6-3. It was built with macports. No new updates in the ports tree. I went ahead and applied this patch to my portfile which effectively will apply the no openmp configure flag when building ImageMagick.

This fixed the issue. Can't say I know enough about threading and the like to fully understand what the issue is, but disabling openmp fixed it.

Cheers