Re: GraphicsMagick may collapse when binding into a server

Feng Liyuan <[email protected]> Mon, 20 May 2013 11:08:33 +0800
Newsgroups gmane.comp.video.graphicsmagick.bugs
Message-ID <CAL6niPVxurSqzs_4Cvk+ebiDDU=qbx3=4bzoecpS3U-+0fYipQ@mail.gmail.com>
Thanks for your help.

If I want to `invoking InitializeMagick() once`, did it mean
`InitializeMagick(NULL)` because I canot find `InitializeMagick()`?


On Fri, May 17, 2013 at 10:12 PM, Bob Friesenhahn <
[email protected]> wrote:

> On Fri, 17 May 2013, Feng Liyuan wrote:
>
>  I bind these code into a golang server to deal with images.
>>
>>       #cgo pkg-config: GraphicsMagick
>>
>>       #include <magick/api.h>
>>
>>       static int GMCmd(int argc, char **argv) {
>>           int status;
>>           status = GMCommand(argc, argv);
>>           return status;
>>       }
>>
>>
>> It may collapse and let server panic.
>>
>
> I am not sure how a server might panic.  At any rate, the solution is
> simple.
>
> Add
>
>   InitializeMagick(*argv);
>
> after the
>
>   int status;
>
> And all should be well.  In fact it should be better since after invoking
> InitializeMagick() once, all of GM's internal semaphores are fully
> initialized and so you can safely invoke GMCommand() in a threaded context
> without fear of any race condition.
>
> Bob
> --
> Bob Friesenhahn
> [email protected], http://www.simplesystems.org/**
> users/bfriesen/ <http://www.simplesystems.org/users/bfriesen/>
> GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/




-- 
冯立元

------------------------------------------------------------------------------
AlienVault Unified Security Management (USM) platform delivers complete
security visibility with the essential security capabilities. Easily and
efficiently configure, manage, and operate all of your security controls
from a single console and one unified framework. Download a free trial.
http://p.sf.net/sfu/alienvault_d2d

_______________________________________________
Graphicsmagick-bugs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/graphicsmagick-bugs