lkml.org 
[lkml]   [2019]   [May]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 07/15] Add wait_var_event_interruptible()
On Wed, May 15, 2019 at 05:26:28PM +0100, David Howells wrote:
> Add wait_var_event_interruptible() to allow interruptible waits for events.
>
> Signed-off-by: David Howells <dhowells@redhat.com>

Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>

> ---
>
> include/linux/wait_bit.h | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/include/linux/wait_bit.h b/include/linux/wait_bit.h
> index 2b0072fa5e92..7dec36aecbd9 100644
> --- a/include/linux/wait_bit.h
> +++ b/include/linux/wait_bit.h
> @@ -305,6 +305,19 @@ do { \
> __ret; \
> })
>
> +#define __wait_var_event_interruptible(var, condition) \
> + ___wait_var_event(var, condition, TASK_INTERRUPTIBLE, 0, 0, \
> + schedule())
> +
> +#define wait_var_event_interruptible(var, condition) \
> +({ \
> + int __ret = 0; \
> + might_sleep(); \
> + if (!(condition)) \
> + __ret = __wait_var_event_interruptible(var, condition); \
> + __ret; \
> +})
> +
> /**
> * clear_and_wake_up_bit - clear a bit and wake up anyone waiting on that bit
> *
>

\
 
 \ /
  Last update: 2019-05-15 19:31    [W:0.062 / U:7.640 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site