]> git.sesse.net Git - vlc/commitdiff
Block SIGCHLD so we don't get polluted by system() in another thread[1]
authorRémi Denis-Courmont <rem@videolan.org>
Sun, 25 Mar 2007 09:56:25 +0000 (09:56 +0000)
committerRémi Denis-Courmont <rem@videolan.org>
Sun, 25 Mar 2007 09:56:25 +0000 (09:56 +0000)
(though this seem to only happen with debuggers and (?)broken OSes)

[1] system() blocks SIGCHLD, and is probably not intended for multithreading

We cannot assume that blocking calls in other libraries ignore EINTR anyway,
so the only safe approach is to block in all threads (you can unblock it in
your thread if you really want it) except the signal handling thread.

src/network/io.c
src/vlc.c

index 89a1d6cc022733cdcf097bc5d3197157ca7b4616..59f6bdc6b4567bb379c903107fb0c39d747872a1 100644 (file)
@@ -292,8 +292,6 @@ net_ReadInner (vlc_object_t *restrict p_this, unsigned fdc, const int *fdv,
         switch (poll (ufd, fdc, 500))
         {
             case -1:
-                if( errno == EINTR )
-                    continue;
                 goto error;
 
             case 0: // timeout
@@ -442,8 +440,6 @@ ssize_t __net_Write( vlc_object_t *p_this, int fd, const v_socket_t *p_vs,
         switch (val)
         {
             case -1:
-                if( errno == EINTR )
-                    continue;
                msg_Err (p_this, "Write error: %s", net_strerror (net_errno));
                goto out;
 
index 9b679a3b6e4c9072f01514858d1bd1cbcda1a334..27e330e1b4ae5bc076a78787c9d943e567ba961a 100644 (file)
--- a/src/vlc.c
+++ b/src/vlc.c
@@ -103,7 +103,7 @@ int main( int i_argc, char *ppsz_argv[] )
      * Note that we set the signals after the vlc_create call. */
     static const int sigs[] = { SIGINT, SIGHUP, SIGQUIT, SIGTERM };
     /* Ignored signals */
-    static const int ignored[] = { SIGALRM, SIGPIPE };
+    static const int ignored[] = { SIGALRM, SIGPIPE, SIGCHLD };
 
     sigset_t set;
     pthread_t sigth;