On 11/2/07, John Buckman <[EMAIL PROTECTED]> wrote:
>
> What do the other aolserver programmers do to ask all the tcl interps
> to reload, so that new code can be brought in without restarting the
> server?
>
> I have a technique (described below) but it's not bug-free, so I was
> wondering what people recommended?
>
> One possibility, would be to ask all the tcl interpreters to exit on
> the next page request, so that a new thread and thus new tcl
> interpreter is created, loading up the new libraries.  I don't know
> how to do that, though.
>
> Currently, I have a namespaced global variable $reload::time that is
> set to the time when the last "package forget/package require". was
> run  When I want to reload all interpreters, I set a nsv variable to
> the current time, and a function registered as
>
>      ns_register_filter postauth GET /* mooch_reload_check
>
> runs for every page, so that if the nsv's reload time is not the same
> as the local interp's reload time, then I run:
>
>         foreach p [package names] {
>              package forget $p
>         }
>
> This seems to mostly work, but some interpreters don't play nice.
>
> Other suggestions.... ?
>
> -john


I use ns_eval {source the_tcl_file} which only works for one file at a time,
but seems to make sure the files are reloaded in every interpreter including
scheduled procedure threads. Reloading in a filter does not work for
scheduled proc threads. OpenACS has this technique that reloads changed
files in a registered filter, but it suffers from the same problem that
occaisionally the files are not reloaded into the interpreter.

Dave


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> 
with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: 
field of your email blank.

Reply via email to