2 * Utility macros of ISH
4 * Copyright (c) 2014-2016, Intel Corporation.
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18 #define WAIT_FOR_SEND_SLICE (HZ / 10)
19 #define WAIT_FOR_CONNECT_SLICE (HZ / 10)
22 * Waits for specified event when a thread that triggers event can't signal
23 * Also, waits *at_least* `timeinc` after condition is satisfied
25 #define timed_wait_for(timeinc, condition) \
32 completed = (condition); \
33 for (j = jiffies, done = 0; !done; ) { \
34 schedule_timeout(timeinc); \
35 if (time_is_before_eq_jiffies(j + timeinc)) \
38 } while (!(completed)); \
43 * Waits for specified event when a thread that triggers event
44 * can't signal with timeout (use whenever we may hang)
46 #define timed_wait_for_timeout(timeinc, condition, timeout) \
53 for (j = jiffies, done = 0; !done; ) { \
54 schedule_timeout(timeinc); \
55 if (time_is_before_eq_jiffies(j + timeinc)) \
61 } while (!(condition)); \