TclHttpd: Working example of multi-threaded operation?


does anyone use the multi-threaded feature of the TclHttpd server
and got the server running?

How do I install an URL handler to be run as a worker
thread correctly? Have I understood it correctly that
the URL handler must respond with Thread_Respond like in
the following example?

Url_PrefixInstall $prefix [list InternalThreadedDomainHandler $prefix] -thread 1

proc getTimedPage {} {
  set html    "<html><title>Timed Page</title><body>\n"
  append html "Time: [clock format [clock seconds]]"
  append html "</body>\n"
  return $html

proc InternalThreadedDomainHandler {prefix sock suffix} {
  upvar #0 Httpd$sock data
  set html [getTimedPage]
  Thread_Respond $sock [list Httpd_ReturnData $sock text/html $html]

Working code highly appreciated!


Relevant Pages

  • Re: Huge task finished
    ... Only thing I found was I had to give each page a 'php' extension ... tells Apache to treat html as php. ... The point of the prefix is to allow the unprefixed pagename to be used as ...
  • Re: Bes XPath query?
    ... So that is XHTML and that means, if the document is parsed by an XML parser, that you need to bind a prefix to the namespace URI and use that prefix in your XPath expressions. ... Is that XPath over HTML, as some browsers like Mozilla or Opera provide? ...
  • need hint for adabrowse usage
    ... -- noticed a fact about the html I'd like help with. ... -- about "A comment block is any sequence of consecutive Ada 95 ... -- lines that start with the same prefix." ... -- puzzled why all but one of separate comment blocks disappear from ...