Changeset 54668b797785ffe895317f3e2bb81bcb8baac715
- Timestamp:
- 31/08/07 13:21:43
(1 year ago)
- Author:
- Rémi Denis-Courmont <rem@videolan.org>
- git-committer:
- Rémi Denis-Courmont <rem@videolan.org> 1188559303 +0000
- git-parent:
[64099a686f824e59b949aa89b47894cdb63016f2]
- git-author:
- Rémi Denis-Courmont <rem@videolan.org> 1188559303 +0000
- Message:
Document signal handling
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r80c8dcf |
r54668b7 |
|
| 99 | 99 | |
|---|
| 100 | 100 | #if !defined(WIN32) && !defined(UNDER_CE) |
|---|
| 101 | | /* Synchronously intercepted signals. They request a clean shutdown, |
|---|
| 102 | | * and force an unclean shutdown if they are triggered again 2+ seconds |
|---|
| 103 | | * later. We have to handle SIGTERM cleanly because of daemon mode. |
|---|
| | 101 | /* Synchronously intercepted POSIX signals. |
|---|
| | 102 | * |
|---|
| | 103 | * In a threaded program such as VLC, the only sane way to handle signals |
|---|
| | 104 | * is to block them in all thread but one - this is the only way to |
|---|
| | 105 | * predict which thread will receive them. If any piece of code depends |
|---|
| | 106 | * on delivery of one of this signal it is intrinsically not thread-safe |
|---|
| | 107 | * and MUST NOT be used in VLC, whether we like it or not. |
|---|
| | 108 | * There is only one exception: if the signal is raised with |
|---|
| | 109 | * pthread_kill() - we do not use this in LibVLC but some pthread |
|---|
| | 110 | * implementations use them internally. You should really use conditions |
|---|
| | 111 | * for thread synchronization anyway. |
|---|
| | 112 | * |
|---|
| | 113 | * Signal that request a clean shutdown, and force an unclean shutdown |
|---|
| | 114 | * if they are triggered again 2+ seconds later. |
|---|
| | 115 | * We have to handle SIGTERM cleanly because of daemon mode. |
|---|
| 104 | 116 | * Note that we set the signals after the vlc_create call. */ |
|---|
| 105 | 117 | static const int exitsigs[] = { SIGINT, SIGHUP, SIGQUIT, SIGTERM }; |
|---|
| | 118 | /* Signals that cause a no-op: |
|---|
| | 119 | * - SIGALRM should not happen, but lets stay on the safe side. |
|---|
| | 120 | * - SIGPIPE might happen with sockets and would crash VLC. It MUST be |
|---|
| | 121 | * blocked by any LibVLC-dependant application, in addition to VLC. |
|---|
| | 122 | * - SIGCHLD is comes after exec*() (such as httpd CGI support) and must |
|---|
| | 123 | * be dequeued to cleanup zombie processes. |
|---|
| | 124 | */ |
|---|
| 106 | 125 | static const int dummysigs[] = { SIGALRM, SIGPIPE, SIGCHLD }; |
|---|
| 107 | 126 | |
|---|