Re: [julia-users] Handling signals/ctrl-c in Julia

2016-06-09 Thread Ulf Worsoe
Hm. That would work. Thank you for that suggestion! On Wednesday, June 8, 2016 at 2:05:26 PM UTC+2, Yichao Yu wrote: > > On Wed, Jun 8, 2016 at 4:39 AM, Ulf Worsoe <ulf.w...@mosek.com > > wrote: > > In this case the callback function is guaranteed to always be called

Re: [julia-users] Handling signals/ctrl-c in Julia

2016-06-08 Thread Ulf Worsoe
, 2016 at 6:29 AM, Ulf Worsoe <ulf.w...@mosek.com > > wrote: > > The symbol jl_signal_pending is exported, and the following appears to > work > > (assuming, of course, sig_atomic_t is an int): > > > > function callback_func() > > if unsafe_lo

Re: [julia-users] Handling signals/ctrl-c in Julia

2016-06-06 Thread Ulf Worsoe
l-c? On Monday, June 6, 2016 at 10:25:29 AM UTC+2, Ulf Worsoe wrote: > > It appears to work in Julia 0.4 - at least I hasn't crashed yet - but I > have not really stress tested it. > > Just disabling SIGINT only gets me half of the way. It will stop the > function from crashing

Re: [julia-users] Handling signals/ctrl-c in Julia

2016-06-06 Thread Ulf Worsoe
all(:my_c_function, Void, (Ptr{Void},), cfunction(callback_func, Cint,())) end end and on the native side: void my_c_func(int (*callback)()) { } On Monday, June 6, 2016 at 10:25:29 AM UTC+2, Ulf Worsoe wrote: > > It appears to work in Julia 0.4 - at least I hasn't crashed yet - but

Re: [julia-users] Handling signals/ctrl-c in Julia

2016-06-06 Thread Ulf Worsoe
all() disable_sigint() do ccall(:my_c_function, Void, (Ptr{Void},), cfunction()) end end and on the native side: void my_c_func On Monday, June 6, 2016 at 10:25:29 AM UTC+2, Ulf Worsoe wrote: > > It appears to work in Julia 0.4 - at least I hasn't crashed yet - but I > have not really s

Re: [julia-users] Handling signals/ctrl-c in Julia

2016-06-06 Thread Ulf Worsoe
the call when a sufficiently good solution has been found. Is there any robust way to receive notification about ctrl-c or check if a ctrl-c has happened before returning from a native function? On Friday, June 3, 2016 at 5:24:28 PM UTC+2, Yichao Yu wrote: > > On Fri, Jun 3, 2016 at 4:51 A

[julia-users] Handling signals/ctrl-c in Julia

2016-06-03 Thread Ulf Worsoe
I am developing Mosek.jl. That library works by creating a task object, adding data to it and calling a solve function. When a user in interactive mode hits ctrl-c, calls to native functions are terminated, and that leaves the task object in an inconsistent state, meaning that even calling