From: Jonathan Gilbert <logic@deltaq.org>
To: "Pratyush Yadav me-at-yadavpratyush.com |GitHub Public/Example
Allow|" <172q77k4bxwj0zt@sneakemail.com>
Cc: Jonathan Gilbert via GitGitGadget <gitgitgadget@gmail.com>,
Git Mailing List <git@vger.kernel.org>,
Jonathan Gilbert <rcq8n2xf3v@liamekaens.com>,
Jonathan Gilbert <JonathanG@iqmetrix.com>
Subject: Re: [PATCH 2/2] git-gui: revert untracked files by deleting them
Date: Mon, 4 Nov 2019 11:36:07 -0600 [thread overview]
Message-ID: <CAPSOpYtBRvDX4by_k_ViuFN66vKx=WM7zcQ_JXivxApDBOGJ1w@mail.gmail.com> (raw)
In-Reply-To: <20191103074453.56ubga6eitjhp6rf@yadavpratyush.com>
On Sun, Nov 3, 2019 at 1:48 AM Pratyush Yadav me-at-yadavpratyush.com
|GitHub Public/Example Allow| <172q77k4bxwj0zt@sneakemail.com> wrote:
> > + after idle [list after 0 [list \
> > + delete_helper \
> > $path_list \
> > - [concat $after [list ui_ready]]
> > + $path_index \
> > + $deletion_errors \
> > + $deletion_error_path \
> > + $batch_size \
> > + ]]
>
> Using `after idle` means in theory we put an undefined maximum time
> limit on the deletion process. Though I suspect in real life it would be
> a pretty short time.
>
> Nonetheless, should you instead do this asynchronously, instead of
> waiting for the event loop to enter an idle state? This means using
> `after 0` directly, instead of doing `after idle [list after 0...`. I
> haven't tested it, but AFAIK this should also keep the UI active while
> not depending on the state of the event loop.
>
> What benefits does your way have over just passing the entire list
> (without batching) to an async script to do processing in the
> background?
I forgot to include this in my point-form list at the end of the
preceding e-mail. What should I be looking into to achieve the same
sort of behaviour, where the UI isn't frozen and the user is getting
period updates about the progress of a large deletion, without using
batches on the UI thread? Is that a thing, or am I misunderstanding
you w.r.t. to doing this asynchronously?
For what it's worth, I used `after idle {after 0 ..}` based on the
recommendation of the Tcler's Wiki [0]:
> An after idle that reschedules itself causes trouble, as the manual warns (PYK 2012-09: the docs no-longer contain this warning, but it still applies):
>
> At present it is not safe for an idle callback to reschedule itself
> continuously. This will interact badly with certain features of
> Tk that attempt to wait for all idle callbacks to complete.
> If you would like for an idle callback to reschedule itself
> continuously, it is better to use a timer handler with a zero
> timeout period.
>
> Even this warning is oversimplified. Simply scheduling a timer handler with a zero timeout period can mean that the event loop will never be idle, keeping other idle callbacks from firing. The truly safe approach combines both:
>
> proc doOneStep {} {
> if { [::sim::one_step] } {
> after idle [list after 0 doOneStep]
> #this would work just as well:
> #after 0 [list after idle doOneStep]
> }
> return
> }
> sim::init .c 640 480
> doOneStep
>
> This skeleton should be considered the basic framework for performing long running calculations within a single Tcl interpreter.
Thanks,
Jonathan Gilbert
[0] https://wiki.tcl-lang.org/page/Keep+a+GUI+alive+during+a+long+calculation
next prev parent reply other threads:[~2019-11-04 17:36 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-30 6:48 [PATCH 0/2] git-gui: revert untracked files by deleting them Jonathan Gilbert via GitGitGadget
2019-10-30 6:48 ` [PATCH 1/2] git-gui: consolidate naming conventions Jonathan Gilbert via GitGitGadget
2019-11-03 0:27 ` Pratyush Yadav
2019-10-30 6:48 ` [PATCH 2/2] git-gui: revert untracked files by deleting them Jonathan Gilbert via GitGitGadget
2019-11-03 7:44 ` Pratyush Yadav
2019-11-04 16:04 ` Jonathan Gilbert
2019-11-04 17:36 ` Jonathan Gilbert [this message]
2019-10-30 9:06 ` [PATCH 0/2] " Bert Wesarg
2019-10-30 17:16 ` Jonathan Gilbert
2019-11-03 1:12 ` Pratyush Yadav
2019-11-03 4:41 ` Jonathan Gilbert
2019-11-03 7:54 ` Pratyush Yadav
2019-11-07 7:05 ` [PATCH v2 " Jonathan Gilbert via GitGitGadget
2019-11-07 7:05 ` [PATCH v2 1/2] git-gui: consolidate naming conventions Jonathan Gilbert via GitGitGadget
2019-11-07 7:05 ` [PATCH v2 2/2] git-gui: revert untracked files by deleting them Jonathan Gilbert via GitGitGadget
2019-11-11 19:25 ` Pratyush Yadav
2019-11-11 21:55 ` Jonathan Gilbert
2019-11-11 22:59 ` Philip Oakley
2019-11-12 4:49 ` Jonathan Gilbert
2019-11-12 10:45 ` Philip Oakley
2019-11-12 16:29 ` Jonathan Gilbert
2019-11-26 11:22 ` Philip Oakley
2019-11-12 19:35 ` Pratyush Yadav
2019-11-11 19:35 ` [PATCH v2 0/2] " Pratyush Yadav
2019-11-13 9:56 ` [PATCH v3 " Jonathan Gilbert via GitGitGadget
2019-11-13 9:56 ` [PATCH v3 1/2] git-gui: consolidate naming conventions Jonathan Gilbert via GitGitGadget
2019-11-13 9:56 ` [PATCH v3 2/2] git-gui: revert untracked files by deleting them Jonathan Gilbert via GitGitGadget
2019-11-16 15:11 ` Pratyush Yadav
2019-11-16 21:42 ` Jonathan Gilbert
2019-11-17 6:56 ` [PATCH v4 0/2] " Jonathan Gilbert via GitGitGadget
2019-11-17 6:56 ` [PATCH v4 1/2] git-gui: consolidate naming conventions Jonathan Gilbert via GitGitGadget
2019-11-17 6:56 ` [PATCH v4 2/2] git-gui: revert untracked files by deleting them Jonathan Gilbert via GitGitGadget
2019-11-24 13:09 ` Pratyush Yadav
2019-11-19 15:21 ` [PATCH v4 0/2] " Pratyush Yadav
2019-11-19 16:56 ` Jonathan Gilbert
2019-11-24 20:37 ` [PATCH v5 0/3] " Jonathan Gilbert via GitGitGadget
2019-11-24 20:37 ` [PATCH v5 1/3] git-gui: consolidate naming conventions Jonathan Gilbert via GitGitGadget
2019-11-24 20:37 ` [PATCH v5 2/3] git-gui: update status bar to track operations Jonathan Gilbert via GitGitGadget
2019-11-27 21:55 ` Pratyush Yadav
2019-11-28 7:34 ` Jonathan Gilbert
2019-11-24 20:37 ` [PATCH v5 3/3] git-gui: revert untracked files by deleting them Jonathan Gilbert via GitGitGadget
2019-11-27 22:03 ` Pratyush Yadav
2019-11-28 8:30 ` [PATCH v6 0/3] " Jonathan Gilbert via GitGitGadget
2019-11-28 8:30 ` [PATCH v6 1/3] git-gui: consolidate naming conventions Jonathan Gilbert via GitGitGadget
2019-11-28 8:30 ` [PATCH v6 2/3] git-gui: update status bar to track operations Jonathan Gilbert via GitGitGadget
2019-11-30 23:05 ` Pratyush Yadav
2019-12-01 2:12 ` Jonathan Gilbert
2019-12-01 11:43 ` Philip Oakley
2019-12-01 20:09 ` Jonathan Gilbert
2019-11-28 8:30 ` [PATCH v6 3/3] git-gui: revert untracked files by deleting them Jonathan Gilbert via GitGitGadget
2019-12-01 2:28 ` [PATCH v7 0/3] " Jonathan Gilbert via GitGitGadget
2019-12-01 2:28 ` [PATCH v7 1/3] git-gui: consolidate naming conventions Jonathan Gilbert via GitGitGadget
2019-12-01 2:28 ` [PATCH v7 2/3] git-gui: update status bar to track operations Jonathan Gilbert via GitGitGadget
2020-02-26 8:24 ` Benjamin Poirier
2020-03-02 18:14 ` Pratyush Yadav
2019-12-01 2:28 ` [PATCH v7 3/3] git-gui: revert untracked files by deleting them Jonathan Gilbert via GitGitGadget
2019-12-05 18:54 ` [PATCH v7 0/3] " Pratyush Yadav
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAPSOpYtBRvDX4by_k_ViuFN66vKx=WM7zcQ_JXivxApDBOGJ1w@mail.gmail.com' \
--to=logic@deltaq.org \
--cc=172q77k4bxwj0zt@sneakemail.com \
--cc=JonathanG@iqmetrix.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=rcq8n2xf3v@liamekaens.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).