|
2022-09-09
| ||
| 14:28 | • Closed ticket [a11678b759]: documentation improvement: "after 0 cmd"</... artifact: f43aa9afcb user: oehhar | |
|
2022-08-18
| ||
| 12:13 | • Ticket [a11678b759]: 4 changes artifact: 1e6e90fe1e user: oehhar | |
| 12:05 | • Ticket [a11678b759]: 4 changes artifact: 7df041f742 user: oehhar | |
| 12:03 | Ticket [a11678b759]: improve after documentation for time <= 0. check-in: 2706ae6bed user: oehhar tags: ticket-a11678b759-after-documentation | |
| 11:51 | • Ticket [a11678b759] documentation improvement: "after 0 cmd" statu... artifact: 9d0e895439 user: oehhar | |
| 11:19 | • Ticket [a11678b759]: 3 changes artifact: 4b37062d84 user: sebres | |
| 09:58 | • New ticket [a11678b759]. artifact: 2bbb7b8897 user: oehhar | |
documentation improvement: "after 0 cmd"
- Add information: "after 0 cmd" puts the command in front of the event queue. Other already registered events will run after this event. This is indirectly contained in a remark at the very bottom of the page.
- Eventually say/define, what happens for negative time "after -1 cmd" ? I don't know what it does, but there is no error message. Maybe legalize it ;-).
- Eventually say something about the maximum value of the wait time.
- At the bottom of the page, there is an example "after idle [list after 0 doOneStep]". This guarantees to keep the GUI responsive. To my knowledge, specially metawidgets like TkTable also require "after 200" events to run to show correctly. To my knowledge, this is not the case. Also, what is the advantage over "update (idletasks)? I basically don't understand the information (even as the wiki page is great).
I will care about the first point. Any opinions on the other points welcome.
Thank you all, Harald
2706ae6bedTicket [a11678b759]: improve after documentation for time <= 0. check-in2022-08-18 12:03:23
"after 0 cmd" puts the command in front of the event queue. Other already registered events will run after this event.
This is not quite correct. Basically when adding to the queue it considers other timers there, so in case other events with 0 are already available, it would add new event after them and not in head of the queue. Also it is important to consider the "epoch" of event (an event created during evaluation of another event will be executed firstly by the next round of event cycle evaluation).
Negative offset is the same as 0.
Regarding after idle [list after 0 doOneStep], it will guarantee that doOneStep will be evaluated in the second round of event cycle, but firstly after the idle round was done too. It is a kind of retarding of events (surely not the best one) either because of the nested updates somewhere or because of missing filter functionality by update or vwait (e. g. impossibility to invoke update -timer or update -noidle like implemented in RFE fdfbd5e10).
Fundamentally although it can be helpful sometimes, but may be a bit worse concept to rely on timers in this way. It could be sometimes also a sign that a code doesn't register or handle events correctly (instead of count on some state it trust in a time-related evaluation).
Thanks, Sergey, I appreciate. I suppose, it is quite complicated to express this in the man page. I looked to the implementation. Apparently "after 0" is not a no-op, but does wait a sort of a cycle. Also, the wide int time is split to a long type as seconds. There are calculations on a long type without any guard against overflow. A long is 32 bit. So, with 4.294.967.296 seconds, I will hit an overflow. <verbatim> % after 4294967296000 "puts a" after#8 a </verbatim> It returns immediately. So, there is an overflow ;-). Maybe, overflow handling would be great. Take care, Harald
Text proposal in branch [ticket-a11678b759-after-documentation] starting with commit [2706ae6bed].
Apparently a hot potato issue.
Any comment welcome, Harald
Here is the after overflow ticket: [1802895]