This line will do it:

jl_options.handle_signals = JL_OPTIONS_HANDLE_SIGNALS_OFF;

jl_options is DLLEXPORTed, and both it and its type are in julia.h.

I think this is a perfectly good API. True that in general functions
are better than structs, but I don't see any benefit here.

On Fri, May 29, 2015 at 5:29 PM, Isaiah Norton <[email protected]> wrote:
> On Fri, May 29, 2015 at 3:49 PM, Eric Davies <[email protected]> wrote:
>>
>> It seems like it would but I can't figure out how to set any of those
>> options from C. Does anyone here know how?
>
>
> I don't think that is possible right now because the options struct is not
> part of the external API (and, almost certainly should not be). The simplest
> solution is to add an option to `jl_init_with_image` and modify jl_options
> there. That plan doesn't scale very well, but I don't know how many more of
> these options are both embedding-critical and imperative to set before Julia
> is initialized. PR sent if you want to test:
>
> https://github.com/JuliaLang/julia/pull/11489
>
>>
>>
>>
>> On Friday, 29 May 2015 12:31:20 UTC-5, Tim Holy wrote:
>>>
>>> Jeff just merged https://github.com/JuliaLang/julia/pull/11473, which
>>> might
>>> help?
>>>
>>> --Tim
>>>
>>> On Wednesday, March 04, 2015 02:51:19 PM Eric Davies wrote:
>>> > It appears as if that did not solve the problem, though I verified that
>>> > it
>>> > did what was intended. This is unfortunate. I'll continue looking at
>>> > this
>>> > for a day or two but I'm not confident I can find a solution alone.
>>> > Here is
>>> > a minimal set of code to
>>> > replicate: https://gist.github.com/iamed2/e883c6b0b8ff4220d946
>>> >
>>> > On Wednesday, 4 March 2015 06:06:19 UTC-6, Tim Holy wrote:
>>> > > It seems possible we should add a second "boolean" argument to
>>> > > _julia_init
>>> > > (in
>>> > > init.c) that controls whether the signal handlers get set. But as a
>>> > > workaround:
>>> > >
>>> > >
>>> > > http://stackoverflow.com/questions/9495113/how-to-get-the-handlers-name-ad
>>> > > dress-for-some-signals-e-g-sigint-in-postgres
>>> > >
>>> > > You could at least test whether that solves the problem, and then if
>>> > > so
>>> > > perhaps it would be worth opening an issue in julia about whether we
>>> > > need
>>> > > a
>>> > > better solution.
>>> > >
>>> > > BTW, I'm interested in this topic too; see also
>>> > > https://groups.google.com/d/msg/julia-users/dP_J5KilsEs/4CIERQ14vdgJ.
>>> > > We
>>> > > should collaborate on a single solution (and it sounds like you're
>>> > > farther
>>> > > along and perhaps more invested). I'm happy to pitch in if code gets
>>> > > posted
>>> > > somewhere.
>>> > >
>>> > > --Tim
>>> > >
>>> > > On Tuesday, March 03, 2015 09:18:04 PM Eric Davies wrote:
>>> > > > Hi all,
>>> > > >
>>> > > > I'm attempting to embed julia in a MATLAB MEX file. Everything is
>>> > > > going
>>> > > > great, but MATLAB will sometimes segfault after having run some
>>> > > > code
>>> > > > calling Julia.* I believe I have narrowed it down to this
>>> > > > issue: http://ubuntuforums.org/showthread.php?t=2093057 .
>>> > > > Basically, I
>>> > > > believe Julia is registering a SIGSEGV (or maybe other signal?)
>>> > > > handler
>>> > > > that overwrites the default for the JVM set by MATLAB. after the
>>> > > > Julia
>>> > > > function is done, that memory is freed. Then a segfault (or maybe
>>> > > > other
>>> > > > signal?) happens in the JVM and it tries to call Julia's handler
>>> > > > but
>>> > > > segfaults (again) as it is no longer there.
>>> > > >
>>> > > > Can anyone help me find a workaround? Perhaps if there's a way to
>>> > > > "deregister" the handler, or if someone knows a way to get the
>>> > > > current
>>> > > > handler (before calling into Julia) and then setting it back to
>>> > > > that
>>> > >
>>> > > after
>>> > >
>>> > > > Julia is done.
>>> > > >
>>> > > > I've never dealt with signals in C before so I apologize if I'm
>>> > >
>>> > > describing
>>> > >
>>> > > > things incorrectly or missing something.
>>> > > >
>>> > > > Thanks,
>>> > > > Eric
>>> > > >
>>> > > > *I am able to reliably reproduce this by running any MEX function
>>> > >
>>> > > linking
>>> > >
>>> > > > to Julia and calling jl_init, then calling `help clear` in MATLAB.
>>> > > >
>>> > > > P.S.: I'm on Mac OS X 10.10 with MATLAB R2012b and Julia
>>> > >
>>> > > v0.3.6/v0.4.0-dev
>>>
>

Reply via email to