[Top][All Lists]

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

Re: Question about GC in C code.

From: Jan D.
Subject: Re: Question about GC in C code.
Date: Tue, 12 Nov 2002 13:49:56 +0100 (MET)

>     But I confess that I have no clue as how GC works in the C code.
>     Will this approach work?  Will menu_bar_vector be safe from GC?
> You have to modify the GC code in alloc.c to explicitly find these
> C data structures in the menus and mark them the vectors by calling
> mark_object.

I think now I got it.  But instead of adding a Gtk-specific solution
I would like to propose a more generic variant.

How about if alloc.c was modified so other code could register a function
to be called when GC occurs?  That function could then mark lisp
objects as needed.  That way we can keep alloc.c free from knowing all
the details of data structures, and changes to those data structures
can be localized in just one file.  Something like this:

typedef void (*mark_function) (Lisp_Object *argptr);
typedef void (*gc_function) (mark_function func);

register_gc_function (gc_function func);

Then in the Gtk code I can do:

static void
mark_gtk_data (mark_function func)
  /* find menu data and mark */

  register_gc_function (mark_gtk_data);

The reason for mark_function is that mark_object is static in alloc.c, so
I pass it as an argument to gc_function.

Is this feasible?

        Jan D.

reply via email to

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