[LTP] [RFC PATCH] read_all: give more time to wait children finish read action

Richard Palethorpe rpalethorpe@suse.de
Mon Apr 9 14:19:01 CEST 2018


Hello,

Cyril Hrubis writes:

> Hi!
>> OK, I think this change is good except that using a constant time for
>> the usleep is probably bad. Instead we could use an exponential
>> function; so we can start with a sleep of 1 then double it up to a
>> maximum of 20 times (approximately a second for the final wait).
>
> Actually I was thinking of adding such functionality to the test library
> exactly because I do not want to reimplement the exponentialy
> incremented sleep for retry over and overe in each testcase...

Sounds like a good idea.

>
> Maybe we need TST_RETRY_ON_NONZERO() macro that would build the retry
> loop around a function passed as a paramter or something like that.

Or TST_RETRY_LOOP, TST_RETRY_WHILE or
TST_RETRY_WITH_EXPONENTIAL_BACKOFF. :-)

Maybe it should not be a magic macro though, but just an inline function
which you call in the body of a loop which performs the sleep based on a
couple of parameters. I suppose it depends on how nice one can make the
macro.

--
Thank you,
Richard.


More information about the ltp mailing list