Forum OpenACS Development: Re: Re: blueprint and *-init.tcl files

Collapse
Posted by Andrew Piskorski on
Gustaf, more importantly, if you use ns_eval instead, then all re-loading of procs should happen once when needed, and you should be able to remove that apm_load_any_changed_libraries hook entirely. No additional scheduled sweeper procs should be necessary, ns_eval should take care of it all.

The ns_eval comments say that all Tcl interps will sync with the new proc state "on their next _ns_atalloc", but I'm not sure what that means. So depending on precisely how ns_eval works, it may be desirable, in the the request processor, to replace the current apm_load_any_changed_libraries hook with some code that insures that the current thread has processed any and all pending ns_eval updates, by triggering one of these _ns_atalloc events or something like that. And since that's probably very fast, it should always run, regardless of whether rp_performance_mode is true or not. (And if necessary a similar light-weight hook could probably be installed somehow for all non-conn Tcl threads as well.)

Basically, it looks like apm_load_any_changed_libraries is just an old ugly hack which only exists because either its author wasn't aware of ns_eval, or ns_eval wasn't available way back then.