Hi Constantine,

> I wrote a function that downloads file using libcurl. I found out that
> when the the downloading process in progress by `curl_easy_perform` I
> cannot interrupt downloading by Ctrl-C. Even `killall picolisp` does
> not work.
> 
> How I can make signals work during FFI?

PicoLisp FFI does not do anything with signals. However, PicoLisp itself sets a
signal handler for SIGINT (which is normally sent by Ctrl-C) to interrupt
running Lisp code and drop into a breakpoint.

While code is executing in a library like libcurl, all signals defined to be
handled by PicoLisp will be *delayed* until the native code completes and Lisp
takes back control.

Note that killing will indeed work if you don't start a REPL (i.e. in a script).
Then SIGINT retains its default behavior of terminating the process.


I see no way at the moment for a native function called from a REPL, simply
because such foreign functions do not know about Pil's signals.

What if you do

   (call "curl" ...)

instead of a native call, and kill the curl process?

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to