Changeset 8b270041340d60f49902be5d990766c7c288f869

Show
Ignore:
Timestamp:
29/05/08 21:30:36 (4 months ago)
Author:
Rémi Denis-Courmont <rem@videolan.org>
git-committer:
Rémi Denis-Courmont <rem@videolan.org> 1212089436 +0300
git-parent:

[debed14afc143e80839ba97b92ea5be332c4ed51]

git-author:
Rémi Denis-Courmont <rem@videolan.org> 1212080470 +0300
Message:

Block all signals in VLC threads

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/misc/threads.c

    r1746fdd r8b27004  
    3636# include <unistd.h> 
    3737#endif 
     38#include <signal.h> 
    3839 
    3940#define VLC_THREADS_UNINITIALIZED  0 
     
    472473 
    473474#if defined( LIBVLC_USE_PTHREAD ) 
     475    sigset_t set, oldset; 
     476 
     477    /* We really don't want signals to (literaly) interrupt our blocking I/O 
     478     * system calls. SIGPIPE is especially bad, as it can be caused by remote 
     479     * peers through connected sockets. Generally, we cannot know which signals 
     480     * are handled by the main program. Also, external LibVLC bindings tend not 
     481     * to setup a proper signal mask before invoking LibVLC. 
     482     * Hence, we hereby block all signals, except those for which blocking is 
     483     * undefined, as listed below. Note that SIGKILL and SIGSTOP need not be 
     484     * listed (see the documentation for pthread_sigmask) here. */ 
     485    sigfillset (&set); 
     486    sigdelset (&set, SIGFPE); 
     487    sigdelset (&set, SIGILL); 
     488    sigdelset (&set, SIGSEGV); 
     489    sigdelset (&set, SIGBUS); 
     490    pthread_sigmask (SIG_BLOCK, &set, &oldset); 
     491 
    474492    i_ret = pthread_create( &p_priv->thread_id, NULL, thread_entry, boot ); 
     493    pthread_sigmask (SIG_SETMASK, &oldset, NULL); 
    475494 
    476495#ifndef __APPLE__