Commit 8fd6167a authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Following vlc_object_kill(), add vlc_object_dying()

parent 3c5ed2fe
......@@ -97,6 +97,8 @@ struct vlc_object_t
VLC_EXPORT( void *, __vlc_object_create, ( vlc_object_t *, int ) );
VLC_EXPORT( void, __vlc_object_destroy, ( vlc_object_t * ) );
VLC_EXPORT( void, __vlc_object_kill, ( vlc_object_t * ) );
VLC_EXPORT( vlc_bool_t, __vlc_object_dying_unlocked, ( vlc_object_t * ) );
VLC_EXPORT( vlc_bool_t, __vlc_object_dying, ( vlc_object_t * ) );
VLC_EXPORT( void, __vlc_object_attach, ( vlc_object_t *, vlc_object_t * ) );
VLC_EXPORT( void, __vlc_object_detach, ( vlc_object_t * ) );
VLC_EXPORT( void *, __vlc_object_get, ( vlc_object_t *, int ) );
......
......@@ -122,6 +122,9 @@ static inline int __vlc_mutex_lock( const char * psz_file, int i_line,
}
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
# define vlc_assert_locked( m ) \
assert (pthread_mutex_lock (&((m)->mutex)) == EDEADLK)
i_result = pthread_mutex_lock( &p_mutex->mutex );
if ( i_result )
{
......@@ -144,6 +147,10 @@ static inline int __vlc_mutex_lock( const char * psz_file, int i_line,
return i_result;
}
#ifndef vlc_assert_locked
# define vlc_assert_locked( m ) (void)0
#endif
/*****************************************************************************
* vlc_mutex_unlock: unlock a mutex
*****************************************************************************/
......
......@@ -438,6 +438,23 @@ void __vlc_object_kill( vlc_object_t *p_this )
}
vlc_bool_t __vlc_object_dying_unlocked( vlc_object_t *p_this )
{
vlc_assert_locked( &p_this->object_lock );
return p_this->b_die;
}
vlc_bool_t __vlc_object_dying( vlc_object_t *p_this )
{
vlc_bool_t b;
vlc_mutex_lock( &p_this->object_lock );
b = __vlc_object_dying_unlocked( p_this );
vlc_mutex_unlock( &p_this->object_lock );
return b;
}
/**
* find an object given its ID
*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment