chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] performance isssue with FFI callbacks


From: Felix
Subject: Re: [Chicken-users] performance isssue with FFI callbacks
Date: Fri, 25 Mar 2011 12:08:24 +0100 (CET)

From: Tomtom <address@hidden>
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



reply via email to

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