2011/3/31 Tomtom <[email protected]>: > [...] > 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 -- When C++ is your hammer, every problem looks like your thumb. _______________________________________________ Chicken-users mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/chicken-users
