[vlc-devel] commit: Privatize the playlist lock ( Rémi Denis-Courmont )
git version control
git at videolan.org
Wed Mar 4 22:42:02 CET 2009
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Mar 4 23:24:57 2009 +0200| [3cbb926a82ce5bc7ec46bc2a91774abbedf6d7e3] | committer: Rémi Denis-Courmont
Privatize the playlist lock
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3cbb926a82ce5bc7ec46bc2a91774abbedf6d7e3
---
src/playlist/control.c | 6 +++---
src/playlist/engine.c | 2 ++
src/playlist/playlist_internal.h | 1 +
src/playlist/thread.c | 6 ++----
4 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/src/playlist/control.c b/src/playlist/control.c
index 7e1b376..313a145 100644
--- a/src/playlist/control.c
+++ b/src/playlist/control.c
@@ -68,17 +68,17 @@ void __pl_Release( vlc_object_t *p_this )
void playlist_Lock( playlist_t *pl )
{
- vlc_object_lock( pl );
+ vlc_mutex_lock( &pl_priv(pl)->lock );
}
void playlist_Unlock( playlist_t *pl )
{
- vlc_object_unlock( pl );
+ vlc_mutex_unlock( &pl_priv(pl)->lock );
}
void playlist_AssertLocked( playlist_t *pl )
{
- vlc_object_assert_locked( pl );
+ vlc_assert_locked( &pl_priv(pl)->lock );
}
int playlist_Control( playlist_t * p_playlist, int i_query,
diff --git a/src/playlist/engine.c b/src/playlist/engine.c
index 2a46459..0c9a7bf 100644
--- a/src/playlist/engine.c
+++ b/src/playlist/engine.c
@@ -81,6 +81,7 @@ playlist_t * playlist_Create( vlc_object_t *p_parent )
libvlc_priv(p_parent->p_libvlc)->p_playlist = p_playlist;
VariablesInit( p_playlist );
+ vlc_mutex_init( &p->lock );
vlc_cond_init( &p->signal );
/* Initialise data structures */
@@ -181,6 +182,7 @@ static void playlist_Destructor( vlc_object_t * p_this )
assert( !p_sys->p_fetcher );
vlc_cond_destroy( &p_sys->signal );
+ vlc_mutex_destroy( &p_sys->lock );
/* Remove all remaining items */
FOREACH_ARRAY( playlist_item_t *p_del, p_playlist->all_items )
diff --git a/src/playlist/playlist_internal.h b/src/playlist/playlist_internal.h
index aed7edf..86279f6 100644
--- a/src/playlist/playlist_internal.h
+++ b/src/playlist/playlist_internal.h
@@ -83,6 +83,7 @@ typedef struct playlist_private_t
} request;
vlc_thread_t thread; /**< engine thread */
+ vlc_mutex_t lock; /**< dah big playlist global lock */
vlc_cond_t signal; /**< wakes up the playlist engine thread */
int i_last_playlist_id; /**< Last id to an item */
diff --git a/src/playlist/thread.c b/src/playlist/thread.c
index 5ec6ee1..0dac88a 100644
--- a/src/playlist/thread.c
+++ b/src/playlist/thread.c
@@ -552,8 +552,7 @@ static void LoopRequest( playlist_t *p_playlist )
else
{
if( vlc_object_alive( p_playlist ) )
- vlc_cond_wait( &pl_priv(p_playlist)->signal,
- &vlc_internals(p_playlist)->lock );
+ vlc_cond_wait( &p_sys->signal, &p_sys->lock );
}
return;
}
@@ -598,8 +597,7 @@ static void *Thread ( void *data )
/* If there is an input, check that it doesn't need to die. */
while( !LoopInput( p_playlist ) )
- vlc_cond_wait( &pl_priv(p_playlist)->signal,
- &vlc_internals(p_playlist)->lock );
+ vlc_cond_wait( &p_sys->signal, &p_sys->lock );
LoopRequest( p_playlist );
}
More information about the vlc-devel
mailing list