Changeset 7fd923e41a2a29be113391490731b1c82f726185
- Timestamp:
- 05/03/08 16:46:03
(4 months ago)
- Author:
- Rémi Denis-Courmont <rem@videolan.org>
- git-committer:
- Rémi Denis-Courmont <rem@videolan.org> 1209825963 +0300
- git-parent:
[b89d540af12211361bfaa82a200872b3ba4f0eb0]
- git-author:
- Rémi Denis-Courmont <rem@videolan.org> 1209825963 +0300
- Message:
No need to kill VLC if it's exiting already.
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r449fd28 |
r7fd923e |
|
| 53 | 53 | extern void __wgetmainargs(int *argc, wchar_t ***wargv, wchar_t ***wenviron, |
|---|
| 54 | 54 | int expand_wildcards, int *startupinfo); |
|---|
| 55 | | static inline void Kill(void) { } |
|---|
| 56 | 55 | #else |
|---|
| 57 | 56 | |
|---|
| … | … | |
| 60 | 59 | # include <pthread.h> |
|---|
| 61 | 60 | |
|---|
| 62 | | static void Kill (void); |
|---|
| 63 | 61 | static void *SigHandler (void *set); |
|---|
| 64 | 62 | #endif |
|---|
| … | … | |
| 69 | 67 | int main( int i_argc, const char *ppsz_argv[] ) |
|---|
| 70 | 68 | { |
|---|
| 71 | | int i_ret; |
|---|
| | 69 | int i_ret, id; |
|---|
| 72 | 70 | |
|---|
| 73 | 71 | # ifdef __GLIBC__ |
|---|
| … | … | |
| 110 | 108 | |
|---|
| 111 | 109 | /* Create a libvlc structure */ |
|---|
| 112 | | i_ret = VLC_Create(); |
|---|
| 113 | | if( i_ret < 0 ) |
|---|
| 114 | | { |
|---|
| 115 | | return -i_ret; |
|---|
| 116 | | } |
|---|
| | 110 | id = VLC_Create(); |
|---|
| | 111 | if( id < 0 ) |
|---|
| | 112 | return 1; |
|---|
| 117 | 113 | |
|---|
| 118 | 114 | #if !defined(WIN32) && !defined(UNDER_CE) |
|---|
| … | … | |
| 209 | 205 | |
|---|
| 210 | 206 | /* Initialize libvlc */ |
|---|
| 211 | | i_ret = VLC_Init( 0, i_argc, ppsz_argv ); |
|---|
| | 207 | i_ret = VLC_Init( id, i_argc, ppsz_argv ); |
|---|
| 212 | 208 | if( i_ret < 0 ) |
|---|
| 213 | 209 | { |
|---|
| … | … | |
| 220 | 216 | /* Finish the threads */ |
|---|
| 221 | 217 | VLC_CleanUp( 0 ); |
|---|
| 222 | | |
|---|
| 223 | | Kill (); |
|---|
| 224 | 218 | |
|---|
| 225 | 219 | /* Destroy the libvlc structure */ |
|---|
| … | … | |
| 285 | 279 | fprintf (stderr, "signal %d received, terminating vlc - do it " |
|---|
| 286 | 280 | "again quickly in case it gets stuck\n", i_signal); |
|---|
| 287 | | |
|---|
| 288 | | /* Acknowledge the signal received */ |
|---|
| 289 | | Kill (); |
|---|
| | 281 | VLC_Die( 0 ); |
|---|
| 290 | 282 | } |
|---|
| 291 | 283 | else /* time (NULL) <= abort_time */ |
|---|
| … | … | |
| 309 | 301 | /* Never reached */ |
|---|
| 310 | 302 | } |
|---|
| 311 | | |
|---|
| 312 | | |
|---|
| 313 | | static void KillOnce (void) |
|---|
| 314 | | { |
|---|
| 315 | | VLC_Die (0); |
|---|
| 316 | | } |
|---|
| 317 | | |
|---|
| 318 | | static void Kill (void) |
|---|
| 319 | | { |
|---|
| 320 | | static pthread_once_t once = PTHREAD_ONCE_INIT; |
|---|
| 321 | | pthread_once (&once, KillOnce); |
|---|
| 322 | | } |
|---|
| 323 | | |
|---|
| 324 | 303 | #endif |
|---|
| 325 | 304 | |
|---|