in reply to Re: xs, threads and panic
in thread xs, threads and panic

Thanks, BrowserUk, for answer!
I have installed perl5.8.9 (pervious stable version) and error has gone away. It is cool, but script does not work correctly, it does not print "MESSAGE: Hellow world!!!". And I steel don't know, why =\
Note, if we remove threads from code:
change
my $thread = threads->create(sub {$obj->run(&MESSAGE)}) or exit(1); $thread->join();
to
my $callback = sub {$obj->run(&MESSAGE)}; $callback->();
It works fine.

Replies are listed 'Best First'.
Re^3: xs, threads and panic
by BrowserUk (Patriarch) on May 20, 2009 at 13:22 UTC

    Okay. So you are trying to bypass the check that prevent you from passing a reference to a subroutine, by calling into XS and creating an oblique code reference and passing that between threads; and then complaining that it crashes when you bypass the mechanism put in place to prevent you from doing that.

    That's cool. WAD. Working as designed. You reach behind the fireguard and get burned.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      I tried to help the OP with help from perlcall
      void registCallback(cb) SV* cb; PROTOTYPE: $ PPCODE: if (callback_ref == (SV*)NULL) { callback_ref = newSVsv((SV*)cb); } else { SvSetSV(callback_ref, cb); }
      I didn't realize it was WAD after getting error
      Bizarre copy of CODE in entersub (#1) (P) Perl detected an attempt to copy an internal value that is not copyable.
      :)

        Yeah! Me too.

        It was late (actually, very early), my time and I only scanned the XS code, and didn't look at what he was doing down the bottom in the Perl.

        Having also seen the same 5.10 panic message from previously working 5.8 code, I made assumptions.


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.