Artifact Content

Not logged in

Artifact 4cd8cb736a6b17661c4ea63645f15c02108d6231:


# -*- tcl -*- Copyright (c) 2012 Andreas Kupries
# # ## ### ##### ######## ############# #####################
## Application Shutdown Handlers

namespace eval ::atexit {}

# # ## ### ##### ######## ############# #####################
## API commands.

proc ::atexit {cmd} {
    variable ::atexit::handlers
    lappend handlers $cmd
    return
}

namespace eval ::atexit {
    variable handlers {}
}

rename ::exit ::atexit::exit
proc   ::exit {args} {
    variable ::atexit::handlers
    foreach cmd $handlers {
	uplevel \#0 $cmd
    }
    ::atexit::exit {*}$args
}

# # ## ### ##### ######## ############# #####################
return