Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re^5: XS callback to mpv_set_wakeup_callback

by MaxPerl (Novice)
on Jan 18, 2019 at 12:05 UTC ( #1228717=note: print w/replies, xml ) Need Help??

in reply to Re^4: XS callback to mpv_set_wakeup_callback
in thread XS callback to mpv_set_wakeup_callback

Dear Monks, I had a conversation with the developer of mpv. He confirmed that the wakeup callback can be called from any internal mpv thread (which mpv may create and destroy as it pleases). Because Scripting languages often cannot be called safely from foreign threads, it seems not really possible to implement set_wakeup_callback in perl. Instead he suggested that the callback (&callp()) just writes into a wakeup pipe. A similar solution I found on some perl specific posts, too: see for example the last answer of NERDVANA here, the answer of Eric Garland here and I think the Perl SDL bindings discussed also a such solution, see the old discussion here). Unfortunately in the SDL bindings I couldn't find whether they really implemented a pipe. Instead they use a perl_clone way, too. So my question: Could somebody tell me, how I can use a pipe to perl or a shared variable in a C thread, which I didn't created. Or does somebody know a example of a XS module which takes this approach? Thanks for all your help, Max
  • Comment on Re^5: XS callback to mpv_set_wakeup_callback

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1228717]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (12)
As of 2020-09-22 15:21 GMT
Find Nodes?
    Voting Booth?
    If at first I donít succeed, I Ö

    Results (129 votes). Check out past polls.