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: mod_guile design problems


thi <ttn@mingle.glug.org> writes:

> forcer writes:
> 
>  > >> > - I want to make smob's for the request_rec, server_rec and
>  > >> >   conn_rec structures. Those are actually automagically
>  > >> >   destroyed by apache when it's done with it. 
>  >
>  > Hmm.. Guardians can be used to guard Scheme objects from the
>  > Guile garbage collector. The problem is, that it's neither a
>  > Scheme object i want to "protect" nor is it guile's garbage
>  > collector that is freeing the object. :(
> 
> do you have any control over the malloc/free invocation?  (are you asked
> to supply methods or just structs?) 
> if
> the latter (no control), you may have to rely on details w/in each
> structure to see if they are valid or not.  blech.

Actually, i'm supplying neither. I get the request_rec structure
as an argument to a callback-function, in which i'll call any
appropriate Scheme handler for this callback, and passing exactly
this request_rec structure to the handler. The handler might
modify the request_rec structure if it wants to.
The same request_rec is used to multiple callbacks.
After this specific request is over, the request_rec is destroyed.

I can't rely on any details in the structure, since it's free'd :(

The only solution i see so far is to make a copy of the
request_rec structure and pass the copy to the Scheme code. When
it returns, i have to copy the values back, and free the copied
request_rec using the normal smob guides.

This is not a very sleak solution, but the only i can think of. *sigh*
	-forcer

-- 
((email . "forcer@mindless.com")       (www . "http://forcix.cx/")
 (irc   . "forcer@#StarWars (IRCnet)") (gpg . "/other/forcer.gpg"))

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