[Ur] Generalizing transactions

Adam Chlipala adamc at impredicative.com
Wed Dec 1 09:50:26 EST 2010


Marc Weber wrote:
> The manual says:
> "context is the type of state that persists across handling a client request"
>
> So it looks like I can use uw_(set,get)_global and uw_malloc to keep
> caches.
>    

Yes and no.  The global functions will accomplish what you want.  
However, pointers allocated by uw_malloc() should not be referenced 
across requests.  You should use regular malloc() for such memory.  Note 
that uw_set_global() allows you to specify a function to call to free 
the value you set; for anything that lasts across requests, you do need 
to start thinking about explicit freeing.

> Do you want users to print to stderr for logging - or do you want to
> introduce a logging function which also adds time stamps etc? (good idea
> IMHO) - Does it already exist?
>    

Even some of the already-implemented protocols will ignore stderr 
output.  There is some generic logging stuff implemented now, but only 
for use by the protocols, as it isn't exposed via contexts.  This seems 
like a reasonable change to make, and I'll look into it if you open a 
Mantis issue.



More information about the Ur mailing list