[PATCH] weston: don't hang in wait()

Kristian Hoegsberg hoegsberg at gmail.com
Tue Mar 20 13:50:53 PDT 2012


On Sat, Mar 17, 2012 at 03:22:03PM -0700, Bill Spitzak wrote:
> Pausing weston (with ^Z in the shell) and putting it in the
> background made it hang.
> 
> It actually never called sigchld when I killed or made clients exit,
> so it is not clear if this handler is needed at all.

Oh, yeah, oops.  Thanks for fixing that.  The handler is needed and
gets called when one of the clients forked by weston (like
weston-desktop-shell or the screensaver) exits.

Kristian

> diff --git a/src/compositor.c b/src/compositor.c
> index f2ae2f6..914c6c9 100644
> --- a/src/compositor.c
> +++ b/src/compositor.c
> @@ -59,7 +59,9 @@ sigchld_handler(int signal_number, void *data)
>  	int status;
>  	pid_t pid;
>  
> -	pid = wait(&status);
> +	pid = waitpid(-1, &status, WNOHANG);
> +	if (!pid) return 1;
> +
>  	wl_list_for_each(p, &child_process_list, link) {
>  		if (p->pid == pid)
>  			break;

> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel



More information about the wayland-devel mailing list