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: Guile and alarm(2)



> > Perhaps you could install a SIGALRM handler from Guile each time it's
> > called by Apache and remove it before returning?
> 
> Uhm...
> If there's a simple way to do this (like,
> scm_global_dynamic_wind(in, out) or something) this might be a
> solution, else i don't think it's feasable..
> hm... ok, if nothing else helps i guess that's the way to do it
> :)
> 	-forcer

The job of Guile's SCM_(RE)?ALLOW_INTS is to mark places where it's
okay for thread switches, interrupts, etc. to happen.  If they are
ever invoked while data structures are inconsistent, that's a Guile
bug.  There isn't any other indication in Guile of when it is safe to
be interrupted.  So you have to make use of that somehow.

SCM_(RE)?ALLOW_INTS checks if any system asyncs have been marked; if
so, the async handler runs.  That's how applications are supposed to
request that Guile code be interrupted.

So I think you need to call scm_sigaction to establish a handler for
SIG_ALRM while Guile code runs, and restore it when Guile code exits.

Yes, you need something like dynamic-wind, at the C level, to make
sure the handlers are removed at the right times.  Take a look at
scm_internal_dynamic_wind.  That's intended to help out people in
situations like yours; if it's not helpful, then it's misdesigned, and
we'd like to hear about it.

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