On Tue, 05 Feb 2013 16:48:08 -0500
"Mikhail T." <mi+t...@aldan.algebra.com> wrote:

> I'm not writing them -- they already exist. The two Tcl-modules (rivet and 
> websh) both destroy the Tcl-interpreter at exit. The module, that gets to run 
> the clean up last usually causes a crash: 

Are you sure?  My recollection of Tcl is of creating an interpreter
when I want to use it, and destroying it after use.  Many could run
concurrently with a threaded MPM.

The correct place to ensure calling library init and cleanuo
functons more than once doesn't hurt is in the library, and
if Tcl doesn't do that, you might want to report a bug.

Failing that, you could create wrapper functions which
keep track of state, whether as binary on/off or by
reference counting.  Then fix both modules to call those
in place of the problematic ones.  You could even create
another mini-module (say, mod_tcl_lib) to do global
initialisation and cleanup, make it a prerequisite for
the others, then strip those functions altogether
from the 'real' Tcl modules.

-- 
Nick Kew

Reply via email to