Changeset 8b270041340d60f49902be5d990766c7c288f869
- 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
| r1746fdd |
r8b27004 |
|
| 36 | 36 | # include <unistd.h> |
|---|
| 37 | 37 | #endif |
|---|
| | 38 | #include <signal.h> |
|---|
| 38 | 39 | |
|---|
| 39 | 40 | #define VLC_THREADS_UNINITIALIZED 0 |
|---|
| … | … | |
| 472 | 473 | |
|---|
| 473 | 474 | #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 | |
|---|
| 474 | 492 | i_ret = pthread_create( &p_priv->thread_id, NULL, thread_entry, boot ); |
|---|
| | 493 | pthread_sigmask (SIG_SETMASK, &oldset, NULL); |
|---|
| 475 | 494 | |
|---|
| 476 | 495 | #ifndef __APPLE__ |
|---|