Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2019-09-18 03:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The room is dark, and your next move is ...












    Results (221 votes). Check out past polls.

    Notices?