Changeset 4dc02f7b5a9753b4b3fb72189ed302cceb96646c
- Timestamp:
- 04/23/08 21:24:45
(2 months ago)
- Author:
- Rémi Denis-Courmont <rem@videolan.org>
- git-committer:
- Rémi Denis-Courmont <rem@videolan.org> 1208978685 +0300
- git-parent:
[6ed74223505b91d3ebed2f42fea6ccbcfc776622]
- git-author:
- Rémi Denis-Courmont <rem@videolan.org> 1208978685 +0300
- Message:
Win32: Simplify mutex
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r6ed7422 |
r4dc02f7 |
|
| 129 | 129 | typedef BOOL (WINAPI *SIGNALOBJECTANDWAIT) ( HANDLE, HANDLE, DWORD, BOOL ); |
|---|
| 130 | 130 | |
|---|
| 131 | | typedef struct |
|---|
| 132 | | { |
|---|
| 133 | | HANDLE mutex; |
|---|
| 134 | | } vlc_mutex_t; |
|---|
| | 131 | typedef HANDLE vlc_mutex_t; |
|---|
| 135 | 132 | |
|---|
| 136 | 133 | typedef struct |
|---|
| r6ed7422 |
r4dc02f7 |
|
| 102 | 102 | VLC_UNUSED( psz_file); VLC_UNUSED( i_line ); |
|---|
| 103 | 103 | |
|---|
| 104 | | WaitForSingleObject( p_mutex->mutex, INFINITE ); |
|---|
| | 104 | WaitForSingleObject( *p_mutex, INFINITE ); |
|---|
| 105 | 105 | |
|---|
| 106 | 106 | #elif defined( HAVE_KERNEL_SCHEDULER_H ) |
|---|
| … | … | |
| 137 | 137 | VLC_UNUSED( psz_file); VLC_UNUSED( i_line ); |
|---|
| 138 | 138 | |
|---|
| 139 | | ReleaseMutex( p_mutex->mutex ); |
|---|
| | 139 | ReleaseMutex( *p_mutex ); |
|---|
| 140 | 140 | |
|---|
| 141 | 141 | #elif defined( HAVE_KERNEL_SCHEDULER_H ) |
|---|
| … | … | |
| 233 | 233 | /* Increase our wait count */ |
|---|
| 234 | 234 | p_condvar->i_waiting_threads++; |
|---|
| 235 | | SignalObjectAndWait( p_mutex->mutex, p_condvar->event, INFINITE, FALSE ); |
|---|
| | 235 | SignalObjectAndWait( *p_mutex, p_condvar->event, INFINITE, FALSE ); |
|---|
| 236 | 236 | p_condvar->i_waiting_threads--; |
|---|
| 237 | 237 | |
|---|
| … | … | |
| 300 | 300 | /* Increase our wait count */ |
|---|
| 301 | 301 | p_condvar->i_waiting_threads++; |
|---|
| 302 | | result = SignalObjectAndWait( p_mutex->mutex, p_condvar->event, |
|---|
| | 302 | result = SignalObjectAndWait( *p_mutex, p_condvar->event, |
|---|
| 303 | 303 | delay_ms, FALSE ); |
|---|
| 304 | 304 | p_condvar->i_waiting_threads--; |
|---|
| r6ed7422 |
r4dc02f7 |
|
| 230 | 230 | |
|---|
| 231 | 231 | #elif defined( WIN32 ) |
|---|
| 232 | | p_mutex->mutex = CreateMutex( 0, FALSE, 0 ); |
|---|
| 233 | | return ( p_mutex->mutex != NULL ? 0 : 1 ); |
|---|
| | 232 | *p_mutex = CreateMutex( 0, FALSE, 0 ); |
|---|
| | 233 | return (*p_mutex != NULL) ? 0 : ENOMEM; |
|---|
| 234 | 234 | |
|---|
| 235 | 235 | #elif defined( HAVE_KERNEL_SCHEDULER_H ) |
|---|
| … | … | |
| 281 | 281 | #if defined( WIN32 ) |
|---|
| 282 | 282 | /* Create mutex returns a recursive mutex */ |
|---|
| 283 | | p_mutex->mutex = CreateMutex( 0, FALSE, 0 ); |
|---|
| 284 | | return ( p_mutex->mutex != NULL ? 0 : 1 ); |
|---|
| | 283 | *p_mutex = CreateMutex( 0, FALSE, 0 ); |
|---|
| | 284 | return (*p_mutex != NULL) ? 0 : ENOMEM; |
|---|
| 285 | 285 | #elif defined( LIBVLC_USE_PTHREAD ) |
|---|
| 286 | 286 | pthread_mutexattr_t attr; |
|---|
| … | … | |
| 319 | 319 | VLC_UNUSED( psz_file); VLC_UNUSED( i_line ); |
|---|
| 320 | 320 | |
|---|
| 321 | | CloseHandle( p_mutex->mutex ); |
|---|
| | 321 | CloseHandle( *p_mutex ); |
|---|
| 322 | 322 | |
|---|
| 323 | 323 | #elif defined( HAVE_KERNEL_SCHEDULER_H ) |
|---|
| … | … | |
| 418 | 418 | #if defined( HAVE_KERNEL_SCHEDULER_H ) |
|---|
| 419 | 419 | # error Unimplemented! |
|---|
| 420 | | #elif defined( UNDER_CE ) || defined( WIN32 ) |
|---|
| | 420 | #elif defined( UNDER_CE ) |
|---|
| 421 | 421 | #elif defined( WIN32 ) |
|---|
| 422 | 422 | *p_tls = TlsAlloc(); |
|---|