diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2016-05-11 17:07:26 +0200 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2016-05-12 11:37:28 +0200 |
commit | 88648205e3a884e04362a502b1793a2cd3f8ab83 (patch) | |
tree | f2b4b7111968eef5203de736cf012b90de2b3a46 /lib/igt_aux.h | |
parent | d7050f9f79fee8fb7c790f355c984d9e5141e1c5 (diff) |
lib/igt_aux: Polish docs for igt_timeout
Add docs, rename parameter and rename the macro to igt_do_timeout to
make it clear it works like a loop.
v2: Rename instead to igt_until_timeout (Chris).
Acked-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Diffstat (limited to 'lib/igt_aux.h')
-rw-r--r-- | lib/igt_aux.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/igt_aux.h b/lib/igt_aux.h index faaf56ac..30687423 100644 --- a/lib/igt_aux.h +++ b/lib/igt_aux.h @@ -72,8 +72,18 @@ bool __igt_sigiter_continue(struct __igt_sigiter *iter, bool interrupt); #define igt_while_interruptible(enable) \ for (struct __igt_sigiter iter__={}; __igt_sigiter_continue(&iter__, (enable)); ) -#define igt_timeout(T) \ - for (struct timespec t__={}; igt_seconds_elapsed(&t__) < (T); ) +/** + * igt_until_timeout: + * @timeout: timeout in seconds + * + * Convenience macro loop to run the provided code block in a loop until the + * timeout has expired. Of course when an individual execution takes too long, + * the actual execution time could be a lot longer. + * + * The code block will be executed at least once. + */ +#define igt_until_timeout(timeout) \ + for (struct timespec t__={}; igt_seconds_elapsed(&t__) < (timeout); ) void igt_exchange_int(void *array, unsigned i, unsigned j); void igt_permute_array(void *array, unsigned size, |