emacs-devel
[Top][All Lists]
Advanced

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

Re: Lisp object that refers to a C struct


From: Stefan Monnier
Subject: Re: Lisp object that refers to a C struct
Date: Wed, 17 Oct 2012 16:27:39 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux)

>> The code to free the C struct will be the one you write
>> specifically for it, nobody else knows how to free it.
> Then the code that GC's this new Lisp object will have to be entirely
> specific to the layout of the struct I'm using, right?

I said "free" not "GC's".  The GC decide what to free, and takes care of
freeing most of the objects in the heap.  The code that frees
the Lisp_Misc file-watcher will be the generic GC code.  And that
generic code will have to trigger your specific code that frees the
C struct.

> It won't be suitable even for the similar-but-different inotify code,
> right?

Depends, you can make it generic by having the Lisp_Misc object have
2 slots: one containing the pointer to the C struct and another pointing
to the matching freeing function.


        Stefan



reply via email to

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