Changeset 5f3d03fbbf20495f88f871776df3e8a1e0b6cebc

Show
Ignore:
Timestamp:
19/05/07 22:57:48 (2 years ago)
Author:
Rémi Denis-Courmont <rem@videolan.org>
git-committer:
Rémi Denis-Courmont <rem@videolan.org> 1179608268 +0000
git-parent:

[acc91d372a52a64cda5128ed9defa26a654a332c]

git-author:
Rémi Denis-Courmont <rem@videolan.org> 1179608268 +0000
Message:

Use static storage rather than libvlc_global for stuff that is only used in a single file.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/misc/threads.c

    r0e39834 r5f3d03f  
    2828 
    2929#include <stdlib.h> 
     30#include "libvlc.h" 
    3031 
    3132#define VLC_THREADS_UNINITIALIZED  0 
     
    4546#elif defined( UNDER_CE ) 
    4647#elif defined( WIN32 ) 
    47 #elif defined( HAVE_KERNEL_SCHEDULER_H ) 
    48 #elif defined( PTHREAD_COND_T_IN_PTHREAD_H ) 
    49     static pthread_mutex_t once_mutex = PTHREAD_MUTEX_INITIALIZER; 
     48static SIGNALOBJECTANDWAIT SignalObjectAndWait = NULL; 
     49static vlc_bool_t          b_fast_mutex = 0; 
     50static int                 i_win9x_cv = 0; 
     51#elif defined( HAVE_KERNEL_SCHEDULER_H ) 
     52#elif defined( PTHREAD_COND_T_IN_PTHREAD_H ) 
     53static pthread_mutex_t once_mutex = PTHREAD_MUTEX_INITIALIZER; 
    5054#elif defined( HAVE_CTHREADS_H ) 
    5155#endif 
     
    103107            if( hInstLib ) 
    104108            { 
    105                 p_libvlc_global->SignalObjectAndWait = 
     109                SignalObjectAndWait = 
    106110                    (SIGNALOBJECTANDWAIT)GetProcAddress( hInstLib, 
    107111                                                     "SignalObjectAndWait" ); 
    108112            } 
    109113        } 
    110         else 
    111         { 
    112             p_libvlc_global->SignalObjectAndWait = NULL; 
    113         } 
    114  
    115         p_libvlc_global->b_fast_mutex = 0; 
    116         p_libvlc_global->i_win9x_cv = 0; 
    117114 
    118115#elif defined( HAVE_KERNEL_SCHEDULER_H ) 
     
    237234     * As this function is not available on Win9x, we can use the faster 
    238235     * CriticalSections */ 
    239     if( p_this->p_libvlc_global->SignalObjectAndWait && 
    240         !p_this->p_libvlc_global->b_fast_mutex ) 
     236    if( SignalObjectAndWait && !b_fast_mutex ) 
    241237    { 
    242238        /* We are running on NT/2K/XP, we can use SignalObjectAndWait */ 
     
    387383 
    388384    /* Misc init */ 
    389     p_condvar->i_win9x_cv = p_this->p_libvlc_global->i_win9x_cv; 
    390     p_condvar->SignalObjectAndWait = p_this->p_libvlc_global->SignalObjectAndWait; 
    391  
    392     if( (p_condvar->SignalObjectAndWait && 
    393         !p_this->p_libvlc_global->b_fast_mutex) 
     385    p_condvar->i_win9x_cv = i_win9x_cv; 
     386    p_condvar->SignalObjectAndWait = SignalObjectAndWait; 
     387 
     388    if( (p_condvar->SignalObjectAndWait && !b_fast_mutex) 
    394389        || p_condvar->i_win9x_cv == 0 ) 
    395390    {