Allowing GC in Allegro CL SMP during foreign function calls
Felix Filozov
ffilozov at gmail.com
Wed Aug 7 16:59:41 UTC 2013
I moved the code to a different local branch, and I recreated the request
https://github.com/cffi/cffi/pull/29. Hopefully it makes things easier.
On Wed, Jul 31, 2013 at 10:22 AM, Felix Filozov <ffilozov at gmail.com> wrote:
> I've created a pull request https://github.com/cffi/cffi/pull/27.
>
>
> On Tue, Jul 30, 2013 at 11:23 PM, Felix Filozov <ffilozov at gmail.com>wrote:
>
>> Having had a closer look at the code, I noticed that the
>> with-foreign-pointer macro allocates in a static area if #+(version>= 8
>> 1).
>>
>> Perhaps it's better to add additional calls to #+(version>= 8 1) in the
>> %foreign-funcall macro, and the defcfun-helper-forms function, so that if #+(version>=
>> 8 1) the appropriate options are set to allow for GC to run during foreign
>> function execution.
>>
>>
>> On Tue, Jul 30, 2013 at 5:33 PM, Felix Filozov <ffilozov at gmail.com>wrote:
>>
>>> Hi all,
>>>
>>> When defining a foreign function using def-foreign-call, there's an
>>> option one could set called :allow-gc. Setting it to :always, allows the
>>> garbage collector to run while the foreign function is executing.
>>>
>>> At the moment CFFI uses the default value for :allow-gc, which is
>>> :never. This prevents GC from running when a foreign function is executing.
>>>
>>> Moreover, once GC blocks, other processes can't make progress. In my
>>> case, I need GC to run during foreign function execution.
>>>
>>> What do you think about extending the defcfun and foreign-call
>>> interfaces to allow for native options to be passed? name-and-options could
>>> be extended to accept a new argument, :native-args, for example. Then you'd
>>> be able to use defcfun as follows:
>>>
>>> (defcfun ("strlen" :native-args (:allow-gc :always)) :int
>>> (str :string))
>>>
>>> Another option is to create a global variable that holds native
>>> arguments, and def-foreign-call would read this directly.
>>>
>>> Thanks,
>>> Felix
>>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cffi-devel/attachments/20130807/c7b2d930/attachment.html>
More information about the cffi-devel
mailing list