This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Critical sections and marking of free cells


Mikael Djurfeldt <mdj@nada.kth.se> writes:

> SCM_NEWCELL (z);
> SCM_SETCDR (z, <malloced memory>);
> SCM_SETCAR (z, scm_tc16_<name>);
> 
> Have I missed something, or can we actually implement this change?

The path we have taken in SCM is to define a function:

SCM must_malloc_cell(long len, SCM c, char *what)

which returns a pair having C as its car, and LEN bytes of mallocated
memory as its cdr, WHAT being used for error reporting.

In general, I've found that quite a bit of work was necessary to make
SCM robust with respect to interrupt handlers doing significant
allocation -- I'm not sure how Guile has changed from SCM in this
respect.