Sujet : Re: Event loop and http::geturl
De : et99 (at) *nospam* rocketship1.me (et99)
Groupes : comp.lang.tclDate : 25. Jun 2025, 01:19:23
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <103ffab$2b701$1@dont-email.me>
References : 1 2 3
User-Agent : Mozilla Thunderbird
On 6/24/2025 1:01 AM, Jonathan Kelly wrote:
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.
I would think you can use this option on the geturl call:
-command callback