chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] weird FFI callbacks


From: Tomtom
Subject: Re: [Chicken-users] weird FFI callbacks
Date: Thu, 31 Mar 2011 14:58:52 +0200
User-agent: Sup/0.11

thank you for your very interesting answer!

I'm currently investigating the problem from another angle: there seems to be a
"non-callback API" within the JACK API! I'll see if it solves the problem.

Tom

Excerpts from Thomas Chust's message of jeu. mars 31 14:06:15 +0200 2011:
> 2011/3/31 Tomtom <address@hidden>:
> > [...]
> > quick summary: a jack client have to set a callback so the jack
> > server can call it when the client is supposed to do
> > something. Here, the callback call is supposed to trigger some
> > scheme code execution.
> > [...]
> 
> Hello,
> 
> the problem is that callbacks only work if the call from C to Scheme
> happens in the dynamic scope of a call from Scheme to C that uses a
> foreign-safe-lambda. Anything else is bound to break.
> 
> If you have C code that calls registered callbacks at random points in
> time, perhaps even on a different thread, you're out of luck. I don't
> know the jack API, but your example hints that either jack_activate
> should be a foreign-safe-lambda that never returns until some main
> loop is terminated, or you *are* out of luck.
> 
> Your only option in the out of luck situation is not to use regular
> callbacks at all but to implement a sort of in-process remote
> procedure call system where a C stub registered as a callback
> transfers call information to a Scheme thread, waits for a reply from
> there and then returns. Needless to say, this can be relatively tricky
> to implement.
> 
> Ciao,
> Thomas
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]