[PATCH wayland] event-loop: Process idle callbacks after the epoll fds

Bill Spitzak spitzak at gmail.com
Tue Jan 27 17:14:13 PST 2015


This does not look right to me: it means that the idle function will not 
get called until some message comes in from a client.

On 01/27/2015 02:21 PM, Derek Foreman wrote:
> To fix a shutdown crash in weston's x11 compositor I want to move the
> weston X window close to an idle handler.
>
> Since idle handlers are processed at the start of an event loop, the
> handler that deals with window close will run at the start of the
> next input_loop dispatch, after which the dispatcher blocks on epoll
> forever (since all input events that will ever occur have been consumed).
>
> Moving the idle handler callbacks to after the epoll_wait allows this to
> all be completed within a single dispatch, and stops the lock-up from
> occurring.
>
> Signed-off-by: Derek Foreman <derekf at osg.samsung.com>
> ---
>   src/event-loop.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/src/event-loop.c b/src/event-loop.c
> index 1f571ba..0a61a23 100644
> --- a/src/event-loop.c
> +++ b/src/event-loop.c
> @@ -407,7 +407,6 @@ wl_event_loop_dispatch(struct wl_event_loop *loop, int timeout)
>   	struct wl_event_source *source;
>   	int i, count, n;
>
> -	wl_event_loop_dispatch_idle(loop);
>
>   	count = epoll_wait(loop->epoll_fd, ep, ARRAY_LENGTH(ep), timeout);
>   	if (count < 0)
> @@ -421,10 +420,12 @@ wl_event_loop_dispatch(struct wl_event_loop *loop, int timeout)
>
>   	wl_event_loop_process_destroy_list(loop);
>
> +	wl_event_loop_dispatch_idle(loop);
> +
>   	do {
>   		n = post_dispatch_check(loop);
>   	} while (n > 0);
> -		
> +
>   	return 0;
>   }
>
>


More information about the wayland-devel mailing list