From: Tomtom <[email protected]> Subject: [Chicken-users] performance isssue with FFI callbacks Date: Fri, 25 Mar 2011 10:52:46 +0100
> # Callback in scheme > > then I defined the callback in scheme: > >> (define-external >> (my_callback (jack_nframes nframes) ((c-pointer void) arg)) >> int >> 0) >> >> ((foreign-lambda* >> void () >> "jack_set_process_callback(client, my_callback, NULL);")) >> >> (jack_activate client) > > with this, all I get is a peak on my CPU use, and an error when the program > stops (it call jack_deactivate after a second): > Hi! It is essential that the call into C that will potentially invoke the callback is wrapped with "foreign-safe-lambda[*]". Calls to C that might invoke Scheme again need some special setup or the runtime system will get confused. Is "jack_activate" a wrapped C function? If yes, use "foreign-safe-lambda" to bind it. cheers, felix _______________________________________________ Chicken-users mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/chicken-users
