Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

You might find a solution here. Its a long subthread, and the good stuff is towards the end, but (and you'll get this later) you'll need the earlier context.

The best (most complete) version of the test code is here.

The basic idea behind the mechanism is that you call a setup() function from each thread you wish to call back to, passing the callback address, and implicitly, the interpreter context. That setup() function records both, and when the callback occurs, it (temporarily) switches to the appropriate context before calling the callback, and then switches back after.

I haven't touched that code, or any derivatives of it in at least 5 years, nor much perl threading in at least 2. The last version of perl I installed was 5.20! So I am unaware of any changes since (and actually before as I never made it past 5.16 for anything real).

What I'm saying, is if you try the code, I may not be much help in support of it :(

But it might solve your problem if no other solution is presented.

Another (off-the-cuff) possibility would be to spawn a new perl thread to handle the callback and then have it loop over a short sleep. Something like that, but I haven't though it through.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
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". The enemy of (IT) success is complexity.
In the absence of evidence, opinion is indistinguishable from prejudice. Suck that fhit

In reply to Re: XS/C, threads, and calling call_sv() with a code ref by BrowserUk
in thread XS/C, threads, and calling call_sv() with a code ref by stevieb

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others meditating upon the Monastery: (6)
    As of 2019-09-17 19:34 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      The room is dark, and your next move is ...












      Results (215 votes). Check out past polls.

      Notices?