答复: graphicsmagick signal hand ler problem

yzh杨振宏 <[email protected]>
Newsgroups gmane.comp.video.graphicsmagick.help
Message-ID <7354BE8391D7C34B9384A115F0B5444A20A599A5@SVR2115HP380.cn1.global.ctrip.com>
Yes, it can work. Since Go set up its signal handlers and flags (contain SA_ONSTACK) before InitializeMagick, so I try to set back both signal handlers and flags when signal handlers != default in InitializeMagickSignalHandlers (GM default set handlers back but flags is ignored), than program will not crash.

On the other hand, I note that ImageMagick already use a variable establish_signal_handlers to enable/disable own signal handlers and default is set to false for proper reason, i.e., 

MagickCoreGenesis(const char *path, const MagickBooleanType establish_signal_handlers) WandExport void MagickWandGenesis(void) {
  if (IsMagickCoreInstantiated() == MagickFalse)
    MagickCoreGenesis((char *) NULL,MagickFalse); }

So, I believe GM can take the same action for library/application user

-----邮件原件-----
发件人: Bob Friesenhahn [mailto:[email protected]] 
发送时间: 2018年3月1日 22:11
收件人: Requests for help with GraphicsMagick <[email protected]>
主题: Re: [GM-help] graphicsmagick signal handler problem

On Thu, 1 Mar 2018, yzh杨振宏 wrote:

> hi,
>
> I'm a GM API user. I use GM in Go lang. Since Golang require that
>
> "If the non-Go code installs any signal handlers, it must use the 
> SA_ONSTACK flag with sigaction. Failing to do so is likely to cause 
> the program to crash if the signal is received." 
> (https://golang.org/pkg/os/signal/)
>
> So could GM let user determine whether or not set signal handlers (i.e., use a bool variable) in InitializeMagick?

Would it work if GM was to specify SA_ONSTACK when the feature is available?  What harm might result from making this the default?

Otherwise, the using library/application will need to (re)-establish its own signal handlers with sigaction after invoking InitializeMagick().

Bob
--
Bob Friesenhahn
[email protected], http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Graphicsmagick-help mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/graphicsmagick-help
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.