Sujet : Re: Event loop and http::geturl
De : rich (at) *nospam* example.invalid (Rich)
Groupes : comp.lang.tclDate : 24. Jun 2025, 05:21:01
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <103d93c$1q263$1@dont-email.me>
References : 1
User-Agent : tin/2.6.1-20211226 ("Convalmore") (Linux/5.15.139 (x86_64))
Jonathan Kelly <
jonkelly@fastmail.fm> wrote:
So, it looks like ::http::geturl is operating asynchronously, despite my
program NOT using -command.
It does. It is documented as such:
man n http:
Note: The event queue is even used without the -command option. As a
side effect, arbitrary commands may be processed while http::geturl is
running.
The code snippets below are from http-2.9.5.tm which was distributed
(at least) with 8.6.12:
Buried deep in http::geturl:
# geturl does EVERYTHING asynchronously, so if the user
# calls it synchronously, we just do a wait here.
http::wait $token
And the implementation of http::wait is:
proc http::wait {token} {
variable $token
upvar 0 $token state
if {![info exists state(status)] || $state(status) eq ""} {
# We must wait on the original variable name, not the upvar alias
vwait ${token}(status)
}
return [status $token]
}
And the 'vwait' there reenters the event loop and allows other events
to be processed.