zsh-workers
 help / color / mirror / code / Atom feed
From: Sebastian Gniazdowski <sgniazdowski@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: Can periodic hook stop rescheduling?
Date: Thu, 15 Sep 2016 12:18:22 +0200	[thread overview]
Message-ID: <CAKc7PVBPLZ6kG6=w62aTWG3XjfXQi7TEmgunTZ0Ch4a=db8Ubg@mail.gmail.com> (raw)
In-Reply-To: <160914215152.ZM519@torch.brasslantern.com>

On 15 September 2016 at 06:51, Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Sep 14,  8:04pm, Peter Stephenson wrote:
> } Subject: Re: Can periodic hook stop rescheduling?
> }
> } On Tue, 13 Sep 2016 09:18:22 -0700
> } Bart Schaefer <schaefer@brasslantern.com> wrote:
> } > The other (not mutually exclusive) option would be to make recurring
> } > schedules part of the "sched" builtin itself
> }
> } I was thinking of that and sounds like a useful feature anyway.
>
> Yes, the danger is in scheduling something harmful and for a short
> interval and then not being able to turn it off.

This might be a general topic of descheduling, its not-full
convenience. It is done via: sched -item (number of item on sched's
list as man page says). Apparently one has to fork, parse `sched`
output, establish item nr and invoke sched -item. Race condition isn't
possible because when being in function, then not being at idle
prompt, so sched won't be invoked and no deschedule will occur.
However these steps are not very convenient. Forgetting for a moment
about implementation effort, what would be the best is IMO a builtin
schedid that would put an ID (new kind, not the "item") of last
scheduled item into REPLY. No fork, no moving parts (i.e. no change of
entries' positions in the time ordered schedule list), a
hash-table-key-like ID, that a bigger script would be able to save for
use after say 2 hours when user would e.g. "unload plugin" (whatever
this means currently). As for the mistake schedule with short
interval, then maybe – that's not that best for me as schedid – new
builtin ksched, i.e. kill-sched, to deschedule all entries. I've seen
sched's code and it's really basic what's really cool, except maybe
for the around-precmd code when it get's run, I didn't see that. But a
new builtin is rather a unpleasant thing, one has to fill some
registration tables probably? What are chances for schedid, ksched,
automatic rescheduling? Maybe I could implement them when given green
light, however I first need to finish one plugin.

PS. Maybe instead of ksched – schedpop. Removes top entry from the
list. In case of problems with short interval and problematic
scheduled code, one would have to manage to enter schedpop few times,
in many cases single time.

PS2. About my question on periodic hook, is it immune to Ctrl-C?

Best regards,
Sebastian Gniazdowski


  reply	other threads:[~2016-09-15 11:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20160913085130eucas1p19723ac09c11d596542360173e4a4b308@eucas1p1.samsung.com>
     [not found] ` <CAKc7PVDkrKD_2VyvO_2JigwfvU1m=3QwO4Vac=HgHZNbOOU7pA@mail.gmail.com>
     [not found]   ` <20160913142003.480cfd9c@pwslap01u.europe.root.pri>
2016-09-13 16:18     ` Bart Schaefer
2016-09-14 19:04       ` Peter Stephenson
2016-09-15  4:51         ` Bart Schaefer
2016-09-15 10:18           ` Sebastian Gniazdowski [this message]
2016-09-15 22:19             ` Bart Schaefer

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='CAKc7PVBPLZ6kG6=w62aTWG3XjfXQi7TEmgunTZ0Ch4a=db8Ubg@mail.gmail.com' \
    --to=sgniazdowski@gmail.com \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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).