[Bug 260719] Vlc hangs on open file dialog

Rémi Denis-Courmont remi at remlab.net
Sat Jan 22 20:35:30 GMT 2011


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


Rémi Denis-Courmont <remi at remlab.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |remi at remlab.net




--- Comment #21 from Rémi Denis-Courmont <remi remlab net>  2011-01-22 21:35:28 ---
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.

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);

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.

Nevertheless as far as this particular bug is concerned, VLC freezes. That
means the KDE code is waiting for the process synchronously. So there should be
no need to integrate with the main loop.

-- 
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