[Bug 260719] Vlc hangs on open file dialog

Dawit Alemayehu adawit at kde.org
Sun Jan 23 01:28:34 CET 2011


https://bugs.kde.org/show_bug.cgi?id=260719





--- Comment #22 from Dawit Alemayehu <adawit kde org>  2011-01-23 01:28:34 ---
(In reply to comment #21)
> In my opinion, the real problem is that Qt QProcess relies on a signal handler
> to watch for process exit. This is not cooperative... VLC has multiple threads
> in different components, that do create child processes. Yet there can be only
> one signal handler for SIGCHLD at a time and it will catch all process
> terminations.

Yes, the subtle problem with UNIX kernels only providing a non-flexiable signal
mechanism to determine whether a process is still around is well known. You can
see

> The only portable thread-cooperative mechanism to be notified of the
> termination of a child process terminate is more or less:
> 
>     while (waitpid(pid, 0, &status) != pid);

Not really. See Thiago's response to see what they are doing in QProcess
itself:
http://lists.kde.org/?l=kde-core-devel&m=129572982213216&w=2

You can find the entire thread I started for this issue here:
http://lists.kde.org/?t=129572447500001&r=1&w=2

> Indeed, this is how VLC's own code waits for child processes.

> Obviously, this would be difficult to integrate with a poll/select main loop.
> Then, something like this would be needed:
>  - create a pipe,
>  - create a thread (write end of the pipe and child process PID as parameters),
>  - register the read end of the pipe to the main loop,
>  - thread: call waitpid() from the thread entry,
>  - thread: write the process exit status to the pipe,
>  - main loop wakes up,
>  - read the exit status from the pipe,
>  - destroy the pipe and the thread.
> This is admittedly not very straight forward nor very elegant. But I cannot
> think of any simpler yet safe approach.

I know the only simple and elegant solution would be for kernels to provide a
better mechanism for being informed of child process terminations, but wouldn't
the mechanism used in QProcess, as Thiago suggests, a viable solution for you
in VLC ?

-- 
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the Unassigned-bugs mailing list