Posted to tcl by Bradipo at Thu Sep 27 18:47:03 GMT 2018view pretty

# coming from proc service_control_handler:
        all_stopped {
            # Mark we are all done so we can exit at global level
            set ::done 1
        }

...
# how the service begins:
        if {[catch {
            twapi::run_as_service [list [list $service_name ::service_control_handler]]
        } msg]} {
            twapi::eventlog_log "Service error: $msg"
        }
        # We sit in the event loop until service control stop us through
        # the event handler
        vwait ::done
	after 1000