Re: [GM-bugs] GraphicsMagick may collapse when binding into a server
Swiss army knife of image processing
Brought to you by:
bfriesen
From: Bob F. <bfr...@si...> - 2013-05-17 14:12:51
|
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 bfr...@si..., http://www.simplesystems.org/users/bfriesen/ GraphicsMagick Maintainer, http://www.GraphicsMagick.org/ |