Changeset 7d6ea0b199861ba8f0a6d915ad63272ed984672c
- Timestamp:
- 03/03/07 15:25:31
(2 years ago)
- Author:
- Rémi Denis-Courmont <rem@videolan.org>
- git-committer:
- Rémi Denis-Courmont <rem@videolan.org> 1172931931 +0000
- git-parent:
[8274a40e84551abbe85c60c7e71f5988737b73db]
- git-author:
- Rémi Denis-Courmont <rem@videolan.org> 1172931931 +0000
- Message:
Really fix race VLC_Die condition
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r0054378 |
r7d6ea0b |
|
| 243 | 243 | |
|---|
| 244 | 244 | |
|---|
| 245 | | static void KillOnce (void) |
|---|
| 246 | | { |
|---|
| 247 | | VLC_Die (0); |
|---|
| 248 | | } |
|---|
| 249 | | |
|---|
| 250 | | |
|---|
| | 245 | #include <stdbool.h> |
|---|
| 251 | 246 | static void Kill (void) |
|---|
| 252 | 247 | { |
|---|
| 253 | | static pthread_once_t once = PTHREAD_ONCE_INIT; |
|---|
| 254 | | pthread_once (&once, KillOnce); |
|---|
| | 248 | static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; |
|---|
| | 249 | static bool killed = false;; |
|---|
| | 250 | pthread_mutex_lock (&lock); |
|---|
| | 251 | if (!killed) |
|---|
| | 252 | { |
|---|
| | 253 | VLC_Die (0); |
|---|
| | 254 | killed = true; |
|---|
| | 255 | } |
|---|
| | 256 | pthread_mutex_unlock (&lock); |
|---|
| 255 | 257 | } |
|---|
| 256 | 258 | |
|---|