Sujet : Re: Event loop and http::geturl
De : jonkelly (at) *nospam* fastmail.fm (Jonathan Kelly)
Groupes : comp.lang.tclDate : 24. Jun 2025, 09:01:08
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <103dm05$1svqt$1@dont-email.me>
References : 1 2
User-Agent : Mozilla Thunderbird
On 24/6/25 14:21, Rich wrote:
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.
OK. Is there a way to ACTUALLY get geturl to block, or equivalent? I need the geturl to finish before anything else happens.