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

Re: [PATCH] Enable sub-second timeout in zsystem flock



On 6 Jan 2020, at 11:30, Cedric Ware <cedric.ware__bml@xxxxxxxxxxxxxx> wrote:
> Not quite pointless: in the last iteration of the retry loop, if the
> timeout is closer to the current time than the retry interval, zsleep()
> only waits until the timeout, then there's a last locking attempt, and
> only then the function fails.

Oh, i missed that, sorry. That doesn't seem so bad.

On 6 Jan 2020, at 11:30, Cedric Ware <cedric.ware__bml@xxxxxxxxxxxxxx> wrote:
> Also, I thought I'd reuse the same mnumber variable to parse
> the arguments of both -t and -i, but I can change that if it breaks the
> coding style.

It's fine afaik

On 6 Jan 2020, at 11:30, Cedric Ware <cedric.ware__bml@xxxxxxxxxxxxxx> wrote:
> Now that I've thought about it again, I added a similar check for the
> timeout value even though it's a zlong, and I documented that the
> interval is silently capped at LONG_MAX microseconds.  Do you think
> it should be reported as an error instead?

Like i said, it doesn't seem to do much error-checking anywhere else, so i
guess it's consistent... but if it were me i'd probably make any out-of-range
value return an error, yeah.

On 6 Jan 2020, at 11:30, Cedric Ware <cedric.ware__bml@xxxxxxxxxxxxxx> wrote:
> Maybe.  I believe CLOCK_MONOTONIC stops when the system is suspended;
> Linux has CLOCK_BOOTIME that adds the suspend time, but it's not
> portable.  I don't know what would surprise users more between having
> SECONDS run backwards (which it could now), and not including suspend
> time (if it was changed to CLOCK_MONOTONIC).

Since it's mainly used for timing things i think that'd be fine, but maybe
there's something i'm not considering.

On 6 Jan 2020, at 11:30, Cedric Ware <cedric.ware__bml@xxxxxxxxxxxxxx> wrote:
> Thanks for the pointer.  Yes, that could be done, though I don't have
> the time right now.  What I actually had in mind was a test suite I
> could run to check that I didn't break anything elsewhere.  Which is
> "make test", I should have thought of it.  The current tests are still
> successful with the patch.

I'm slightly busy again too but i could try to write a script for it later.
It'd be going into 5.9 anyway

dana



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