Hi,

It is my first mail in this list, and I hope it is the right place. I
apologise if it is not (and please indicate where this question should be
sent in your answer)

I am writing an application that reads images from threads (Linux threads)
Many threads are started and execute the code below (each thread want to
know the size of its image at this stage.)
I run on a SMP machine and I was expected to run one thread per CPU and
therefore to gain time.
But the thread seems to wait for each-other (only one CPU is used).
If I replace the code below by a simple loop (volatile i; for
(i=0;i<100000000<i++);) I can see that my threads uses both CPU (I have a 2
CPU system).
So it looks that something in MagicReadImage use a mutex on something
preventing it to be used in thread...

what do I miss? I am intending to use other imagemagick functions in
threads... Is it a good idea?
Thanks,

/Christophe.

fragment of the thread code:


    mw=NewMagickWand();                           //create a new imagemagick
wand
    if(MagickReadImage(mw,tmp[0]) == MagickFalse) //read the possible image
    {
        for (i=0; i<10; i++) free(tmp[i]);
        return (0);                               //not an image...
    }
    //ok, this looks like a image... get its size:
    height = MagickGetImageHeight(mw);
    width  = MagickGetImageWidth(mw);
    if(mw)mw = DestroyMagickWand(mw);  //release the wand...
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users

Reply via email to