Re: Event loop and http::geturl

Liste des GroupesRevenir à cl tcl 
Sujet : Re: Event loop and http::geturl
De : et99 (at) *nospam* rocketship1.me (et99)
Groupes : comp.lang.tcl
Date : 25. Jun 2025, 08:03:52
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <103g70o$2k78v$1@dont-email.me>
References : 1 2 3 4
User-Agent : Mozilla Thunderbird
On 6/24/2025 5:19 PM, et99 wrote:
On 6/24/2025 1:01 AM, Jonathan Kelly wrote:

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
  
I see you already know about -command, so perhaps what you really want is an example of how to use it.
proc httpCallback {token} { ;# the -command callback - called when transaction completes
     upvar 0 $token state    ;# use this to get the results
     set ::urldone 1         ;# block on the setting of this variable
     return
}
unset -nocomplain ::urldone :# rules out a race condition
http::geturl <your url> -command httpCallback
if {![info exists ::urldone]} {vwait ::urldone} ;# no need to block if the variable exists
The above code is being cautious. There may not be any possibility of a race condition, but this way we rule it out, even if they change the code in the future. It never hurts to unset a variable first that you're going to set later anyway.

Date Sujet#  Auteur
23 Jun 25 * Event loop and http::geturl17Jonathan Kelly
23 Jun 25 +- Re: Event loop and http::geturl1Jonathan Kelly
24 Jun 25 `* Re: Event loop and http::geturl15Rich
24 Jun 25  `* Re: Event loop and http::geturl14Jonathan Kelly
25 Jun 25   `* Re: Event loop and http::geturl13et99
25 Jun 25    `* Re: Event loop and http::geturl12et99
25 Jun 25     `* Re: Event loop and http::geturl11et99
25 Jun 25      `* Re: Event loop and http::geturl10Jonathan Kelly
25 Jun 25       `* Re: Event loop and http::geturl9Rich
26 Jun 25        `* Re: Event loop and http::geturl8et99
26 Jun 25         +* File processing (was Event loop and http::geturl)2Alan Grunwald
26 Jun 25         i`- Re: File processing (was Event loop and http::geturl)1Ralf Fassel
26 Jun 25         `* Re: Event loop and http::geturl5Rich
26 Jun 25          `* Re: Event loop and http::geturl4Jonathan Kelly
26 Jun 25           `* Re: Event loop and http::geturl3et99
27 Jun 25            `* Re: Event loop and http::geturl2Christian Gollwitzer
27 Jun 25             `- Re: Event loop and http::geturl1Ralf Fassel

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal