In a message dated 5/28/05 11:37:23 AM, [EMAIL PROTECTED] writes:


3. Use the package interface along with ns_ictl to manage state clearly, e.g., replace the confusing code in bin/init.tcl with the following and expect folks to own this config for their own install as they do with nsd.tcl:

ns_ictl trace create {
  package require Nsd
  package require Foo
  package require Bar
}

ns_ictl trace dealloc {
  ... default cleanup for Nsd, clear ns_sets, etc...
  ... cleanup, if any, for Foo, Bar, etc.
}




Actually, I meant to point out that unlike the current single ns_init and ns_cleanup procs which the example above seems to follow, there can be mulitple ns_ictl calls -- they're called in FIFO order.  So a better example would be:


ns_itcl trace create {
   package require x
   package require y
}


in package x:

ns_ictl trace dealloc {... cleanup for x ...}

in package y:

ns_ictl trace alloc { ... reinit for y ...}

etc., i.e., the packages can own whatever's need to re-init, cleanup, etc.  This should make it easier to keep things clean and separated on a package by package basis. 

Actually, now that I'm writing this it occurs to me the FIFO order always is wrong -- instead it should be FIFO for init-type things (create, alloc, getconn) and LIFO for cleanup type things (dealloc, freeconn, delete).  I'll fix that.


-Jim
2">

Reply via email to