Changeset da6732062b23f833e860da223901eeeb75eefaf7

Show
Ignore:
Timestamp:
07/05/08 13:22:09 (2 months ago)
Author:
Rémi Denis-Courmont <rdenis@simphalempin.com>
git-committer:
Rémi Denis-Courmont <rdenis@simphalempin.com> 1215256929 +0300
git-parent:

[06e3b333dcadd50c4e335337ac852918331499ca]

git-author:
Rémi Denis-Courmont <rdenis@simphalempin.com> 1215256929 +0300
Message:

vlc_object_alive: lock-less and inlined

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • include/vlc_objects.h

    rc2c6729 rda67320  
    163163    __vlc_object_kill( VLC_OBJECT(a) ) 
    164164 
    165 VLC_EXPORT( bool, __vlc_object_alive, ( vlc_object_t * ) ); 
     165static inline bool __vlc_object_alive (vlc_object_t *obj) 
     166
     167    barrier (); 
     168    return !obj->b_die; 
     169
     170 
    166171#define vlc_object_alive(a) \ 
    167172    __vlc_object_alive( VLC_OBJECT(a) ) 
  • src/libvlccore.sym

    rd4c651d rda67320  
    434434vlc_mutex_init 
    435435vlc_mutex_init_recursive 
    436 __vlc_object_alive 
    437436__vlc_object_attach 
    438437__vlc_object_create 
  • src/misc/objects.c

    rf2dcb78 rda67320  
    548548 
    549549/** 
    550  * Checks whether an object has been "killed". 
    551  * The object lock must be held. 
    552  * 
    553  * Typical code for an object thread could be: 
    554  * 
    555    vlc_object_lock (self); 
    556    ...initialization... 
    557    while (vlc_object_alive (self)) 
    558    { 
    559        ...preprocessing... 
    560  
    561        vlc_object_wait (self); 
    562  
    563        ...postprocessing... 
    564    } 
    565    ...deinitialization... 
    566    vlc_object_unlock (self); 
    567  * 
    568  * 
    569  * @return true iff the object has not been killed yet 
    570  */ 
    571 bool __vlc_object_alive( vlc_object_t *obj ) 
    572 { 
    573     vlc_assert_locked( &(vlc_internals(obj)->lock) ); 
    574     return !obj->b_die; 
    575 } 
    576  
    577  
    578 /** 
    579550 * Signals an object for which the lock is held. 
    580551 * At least one thread currently sleeping in vlc_object_wait() or 
     
    614585 
    615586    vlc_object_signal_unlocked( p_this ); 
     587    /* This also serves as a memory barrier toward vlc_object_alive(): */ 
    616588    vlc_object_unlock( p_this ); 
    617589}