Page 1 of 1

All MagickWand methods are Thread safe

Posted: 2020-04-19T22:24:10-07:00
by ArunKumar
MagickWandGenesis();
MagickWandTerminus();

NewMagickWand();
DestroyMagickWand

MagickReadImage()
MagickWriteImage()

MagickResizeImage()

I'm using the above magickwand method the resize the image
Is all the above methods are thread safe(i.e is able to use this method for multithread operation)?

Re: All MagickWand methods are Thread safe

Posted: 2020-04-20T03:54:43-07:00
by magick
All calls in MagickWand are thread safe except for the MagickWandGenesis() and MagickWandTerminus(). Call MagickWandGenesis() before any threads are created and MagickWandTerminus() after all threads are completed. Also, recall many MagickWand methods are already threaded such as MagickResizeImage().

Re: All MagickWand methods are Thread safe

Posted: 2020-04-20T04:07:57-07:00
by ArunKumar
Hence shall I avoid MagickWandGenesis() and MagickWandTerminus() in using my multithreaded program?

will this create any problem If I avoided the MagickWandGenesis() and MagickWandTerminus() method ?

Re: All MagickWand methods are Thread safe

Posted: 2020-04-20T11:06:27-07:00
by magick
Call MagickWandGenesis() at the beginning of your program before you create threads. Call MagickWandTerminus() after all your threads complete and before your program exits. Although ImageMagick will work without these calls, recommended practices requires you use these methods.