Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Can periodic hook stop rescheduling?



On 15 September 2016 at 06:51, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxxx> 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



Messages sorted by: Reverse Date, Date, Thread, Author