Version 1 of tclsvc - Tcl as an NT Service

Updated 2001-09-12 12:57:16

It's possible to run Tcl scripts as services under Microsoft Windows NT. Matt Newman has done a nice job of producing a wrapper, ""tclsvc"", that lets any event-driven Tcl script run as a service. See it at . -- CLN

As of version 1.1 (1999/6/28 in the source code $Id: 1797,v 1.2 2002-06-21 03:30:15 jcw Exp $) there's a minor problem with this. The service only wakes up when the Tcl event loop fires. Hence, if you try to start or stop it from the services control panel and the Tcl code is blocked, the control panel will think the program has crashed. The simple solution is to put the following code before you start your main event loop:

 proc nothing {} {after 3000 nothing} ; nothing

This will wake the event loop every few seconds, which will allow Tclsrv to process requests for status, shut down, etc. -- DNew