in reply to Sharing XS object?

threads::shared#OBJECTS

Replies are listed 'Best First'.
Re^2: Sharing XS object?
by menth0l (Monk) on Mar 09, 2011 at 14:14 UTC
    I don't know if i understand this correctly:
    # this produces error: "invalid value for shared scalar" my $o :shared = new Tree::BK_XS; # and this causes perl to crash my $o :shared = shared_clone(new Tree::BK_XS);
    I always thought that that link that you've posted refers to hash-based, pure-perl objects?
      # this produces error: "invalid value for shared scalar" my $o :shared = new Tree::BK_XS;

      Which versions of perl/threads/threads::shared are you using?

      Show us the new() method of your module.


      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.
        Versions:
        Perl: ActiveState 5.10
        Threads: 1.82
        Threads-shared: 1.36
        My new() function from BK_XS.xs file:
        #include "EXTERN.h" #include "perl.h" #include "XSUB.h" #include "ppport.h" #include "BKTree.h" MODULE = Tree::BK_XS PACKAGE = Tree::BK_XS PREFIX= BK_ SV * BK_new(package) char * package PROTOTYPE: $ CODE: OBJECT t; SV *tp; t = new_object(); tp = newSVpv((char *)&t, sizeof(OBJECT)); RETVAL = newRV(tp); SvREFCNT_dec(tp); sv_bless(RETVAL, gv_stashpv(package, 0)); SvREADONLY_on(tp); OUTPUT: RETVAL