Hello everyone!

I am using Perl to embed it in C application, I need to have an ability to
interrupt Perl function which
have been invoked with `call_pv`. As function is invoked, it is blocking
thread where it is running.

So, I see the only way to interrupt this blocking thread - via killing this
thread with native "thread kill" functionality.

But killing this thread results on program crash( (F)atal error -- Can't
undef active subroutine during global destruction)
and this can't be handled with exceptions or via other way.

I am looking for correct way of handling the interruption of running perl
function in C.
So, is there any appropriate way to do this?

Regards,
Fedor

On Sat, Jul 25, 2015 at 3:06 PM, Fedor Sumkin <[email protected]> wrote:

> Hello Shlomi,
>
> Thanks for your suggestion, I'll duplicate question to perl-xs and will
> try to answer to your second question in next reply.
>
> Regards,
> Fedor
>
> On Sat, Jul 25, 2015 at 12:23 PM, Shlomi Fish <[email protected]>
> wrote:
>
>> Hi Fedor,
>>
>> On Fri, 24 Jul 2015 15:17:58 +0300
>> Fedor Sumkin <[email protected]> wrote:
>>
>> > Hello,
>> >
>> > I am using Perl to embed it in C application(
>> > http://perldoc.perl.org/perlembed.html).
>> >
>> > I need to have a possibility to interrupt perl function invoked from C
>> code
>> > via `call_pv`/`call_*` methods.
>> >
>> > I tried achieving this via destroying running perl context, but this
>> > resulted on fatal error "Can't undef active subroutine during global
>> > destruction".
>> >
>> > So, how can I interrupt running perl func from C?
>> >
>>
>> Two notes:
>>
>> 1. XS/C-ext/C-embed/etc. are likely out of the scope of
>> [email protected] .
>> You may have better luck here: http://lists.perl.org/list/perl-xs.html .
>>
>> 2. It's not clear to me from reading your message what exactly your issue
>> is.
>> Can you explain?
>>
>> Regards,
>>
>>         Shlomi Fish
>>
>>
>> --
>> -----------------------------------------------------------------
>> Shlomi Fish       http://www.shlomifish.org/
>> The Case for File Swapping - http://shlom.in/file-swap
>>
>> Chuck Norris can end world hunger, but he thinks that hungry people make
>> humanity a more challenging adversary.
>>     — http://www.shlomifish.org/humour/bits/facts/Chuck-Norris/
>>
>> Please reply to list if it's a mailing list post - http://shlom.in/reply
>> .
>>
>> --
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>> http://learn.perl.org/
>>
>>
>>
>

Reply via email to