[vlc-devel] commit: Move object lock and condition into the internals ( Rémi Denis-Courmont )
git version control
git at videolan.org
Tue Jun 17 21:31:31 CEST 2008
vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Tue Jun 17 22:33:26 2008 +0300| [e21ba63b8a25191bb68d2a6d075763a3d65371ff]
Move object lock and condition into the internals
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e21ba63b8a25191bb68d2a6d075763a3d65371ff
---
include/vlc_common.h | 4 ----
include/vlc_plugin.h | 4 ++--
src/libvlc.h | 22 ++++++++++++----------
src/misc/objects.c | 30 ++++++++++++++++--------------
src/modules/cache.c | 2 +-
src/modules/entry.c | 2 +-
src/playlist/engine.c | 4 ++--
7 files changed, 34 insertions(+), 34 deletions(-)
diff --git a/include/vlc_common.h b/include/vlc_common.h
index e217050..451a008 100644
--- a/include/vlc_common.h
+++ b/include/vlc_common.h
@@ -513,10 +513,6 @@ typedef struct vlc_object_internals_t vlc_object_internals_t;
char *psz_header; \
int i_flags; \
\
- /* Object access lock */ \
- vlc_mutex_t object_lock; \
- vlc_cond_t object_wait; \
- \
/* Object properties */ \
volatile bool b_error; /**< set by the object */ \
volatile bool b_die; /**< set by the outside */ \
diff --git a/include/vlc_plugin.h b/include/vlc_plugin.h
index 3cd1e4c..aaedb77 100644
--- a/include/vlc_plugin.h
+++ b/include/vlc_plugin.h
@@ -34,8 +34,8 @@
/**
* Current plugin ABI version
*/
-# define MODULE_SYMBOL 0_9_0k
-# define MODULE_SUFFIX "__0_9_0k"
+# define MODULE_SYMBOL 0_9_0l
+# define MODULE_SUFFIX "__0_9_0l"
/*****************************************************************************
* Add a few defines. You do not want to read this section. Really.
diff --git a/src/libvlc.h b/src/libvlc.h
index c42058e..2457274 100644
--- a/src/libvlc.h
+++ b/src/libvlc.h
@@ -142,16 +142,6 @@ extern void *
vlc_custom_create (vlc_object_t *p_this, size_t i_size, int i_type,
const char *psz_type);
-/* Signal an object without checking for locking consistency. This is wrong. */
-#ifdef __GNUC__
-__attribute__((deprecated))
-#endif
-static inline void
-vlc_object_signal_maybe (vlc_object_t *p_this)
-{
- vlc_cond_signal (&p_this->object_wait);
-}
-
/**
* libvlc_global_data_t (global variable)
*
@@ -189,6 +179,8 @@ struct vlc_object_internals_t
bool b_thread;
/* Objects thread synchronization */
+ vlc_mutex_t lock;
+ vlc_cond_t wait;
int pipes[2];
vlc_spinlock_t spin;
@@ -214,6 +206,16 @@ struct vlc_object_internals_t
#define vlc_internals( obj ) (((vlc_object_internals_t*)(VLC_OBJECT(obj)))-1)
+/* Signal an object without checking for locking consistency. This is wrong. */
+#ifdef __GNUC__
+__attribute__((deprecated))
+#endif
+static inline void
+vlc_object_signal_maybe (vlc_object_t *p_this)
+{
+ vlc_cond_signal (&(vlc_internals(p_this)->wait));
+}
+
/**
* Private LibVLC instance data.
*/
diff --git a/src/misc/objects.c b/src/misc/objects.c
index 23188a9..9dc2483 100644
--- a/src/misc/objects.c
+++ b/src/misc/objects.c
@@ -176,8 +176,8 @@ void *vlc_custom_create( vlc_object_t *p_this, size_t i_size,
p_new->p_private = NULL;
/* Initialize mutexes and condvars */
- vlc_mutex_init( &p_new->object_lock );
- vlc_cond_init( p_new, &p_new->object_wait );
+ vlc_mutex_init( &p_priv->lock );
+ vlc_cond_init( p_new, &p_priv->wait );
vlc_mutex_init( &p_priv->var_lock );
vlc_spin_init( &p_priv->spin );
p_priv->pipes[0] = p_priv->pipes[1] = -1;
@@ -387,8 +387,8 @@ static void vlc_object_destroy( vlc_object_t *p_this )
#endif
vlc_spin_destroy( &p_priv->ref_spin );
- vlc_mutex_destroy( &p_this->object_lock );
- vlc_cond_destroy( &p_this->object_wait );
+ vlc_mutex_destroy( &p_priv->lock );
+ vlc_cond_destroy( &p_priv->wait );
vlc_spin_destroy( &p_priv->spin );
if( p_priv->pipes[1] != -1 )
close( p_priv->pipes[1] );
@@ -403,13 +403,13 @@ static void vlc_object_destroy( vlc_object_t *p_this )
void __vlc_object_lock( vlc_object_t *obj )
{
- vlc_mutex_lock( &obj->object_lock );
+ vlc_mutex_lock( &(vlc_internals(obj)->lock) );
}
void __vlc_object_unlock( vlc_object_t *obj )
{
- vlc_assert_locked( &obj->object_lock );
- vlc_mutex_unlock( &obj->object_lock );
+ vlc_assert_locked( &(vlc_internals(obj)->lock) );
+ vlc_mutex_unlock( &(vlc_internals(obj)->lock) );
}
#ifdef WIN32
@@ -540,8 +540,9 @@ int __vlc_object_waitpipe( vlc_object_t *obj )
*/
void __vlc_object_wait( vlc_object_t *obj )
{
- vlc_assert_locked( &obj->object_lock );
- vlc_cond_wait( &obj->object_wait, &obj->object_lock );
+ vlc_object_internals_t *priv = vlc_internals( obj );
+ vlc_assert_locked( &priv->lock);
+ vlc_cond_wait( &priv->wait, &priv->lock );
}
@@ -554,8 +555,9 @@ void __vlc_object_wait( vlc_object_t *obj )
*/
int __vlc_object_timedwait( vlc_object_t *obj, mtime_t deadline )
{
- vlc_assert_locked( &obj->object_lock );
- return vlc_cond_timedwait( &obj->object_wait, &obj->object_lock, deadline );
+ vlc_object_internals_t *priv = vlc_internals( obj );
+ vlc_assert_locked( &priv->lock);
+ return vlc_cond_timedwait( &priv->wait, &priv->lock, deadline );
}
@@ -583,7 +585,7 @@ int __vlc_object_timedwait( vlc_object_t *obj, mtime_t deadline )
*/
bool __vlc_object_alive( vlc_object_t *obj )
{
- vlc_assert_locked( &obj->object_lock );
+ vlc_assert_locked( &(vlc_internals(obj)->lock) );
return !obj->b_die;
}
@@ -597,8 +599,8 @@ bool __vlc_object_alive( vlc_object_t *obj )
*/
void __vlc_object_signal_unlocked( vlc_object_t *obj )
{
- vlc_assert_locked (&obj->object_lock);
- vlc_cond_signal( &obj->object_wait );
+ vlc_assert_locked (&(vlc_internals(obj)->lock));
+ vlc_cond_signal( &(vlc_internals(obj)->wait) );
}
diff --git a/src/modules/cache.c b/src/modules/cache.c
index 5080008..25b0605 100644
--- a/src/modules/cache.c
+++ b/src/modules/cache.c
@@ -379,7 +379,7 @@ static int CacheLoadConfig( module_t *p_module, FILE *file )
p_module->p_config[i].b_dirty = false;
- p_module->p_config[i].p_lock = &p_module->object_lock;
+ p_module->p_config[i].p_lock = &(vlc_internals(p_module)->lock);
if( p_module->p_config[i].i_list )
{
diff --git a/src/modules/entry.c b/src/modules/entry.c
index db7b731..3c2628a 100644
--- a/src/modules/entry.c
+++ b/src/modules/entry.c
@@ -220,7 +220,7 @@ module_config_t *vlc_config_create (module_t *module, int type)
memset (tab + confsize, 0, sizeof (tab[confsize]));
tab[confsize].i_type = type;
- tab[confsize].p_lock = &module->object_lock;
+ tab[confsize].p_lock = &(vlc_internals(module)->lock);
if (type & CONFIG_ITEM)
{
diff --git a/src/playlist/engine.c b/src/playlist/engine.c
index 4419aa5..8b23bc7 100644
--- a/src/playlist/engine.c
+++ b/src/playlist/engine.c
@@ -225,7 +225,7 @@ static void input_selected_stream_changed( const vlc_event_t * event, void * dat
/* Internals */
void playlist_release_current_input( playlist_t * p_playlist )
{
- vlc_assert_locked( &p_playlist->object_lock );
+ vlc_assert_locked( &(vlc_internals(p_playlist)->lock) );
if( !p_playlist->p_input ) return;
@@ -248,7 +248,7 @@ void playlist_release_current_input( playlist_t * p_playlist )
void playlist_set_current_input(
playlist_t * p_playlist, input_thread_t * p_input )
{
- vlc_assert_locked( &p_playlist->object_lock );
+ vlc_assert_locked( &(vlc_internals(p_playlist)->lock) );
playlist_release_current_input( p_playlist );
More information about the vlc-devel
mailing list