[vlc-devel] commit: Use the normal vlm lock to protect access to the condition variable . (Antoine Cellerier )
git version control
git at videolan.org
Wed Feb 10 20:39:48 CET 2010
vlc | branch: master | Antoine Cellerier <dionoea at videolan.org> | Wed Feb 10 20:40:57 2010 +0100| [beaa348e008d960e42548893d6b85fc7e59593c6] | committer: Antoine Cellerier
Use the normal vlm lock to protect access to the condition variable.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=beaa348e008d960e42548893d6b85fc7e59593c6
---
src/input/vlm.c | 33 +++++++++++++++------------------
src/input/vlm_internal.h | 3 +--
src/input/vlmshell.c | 6 +++---
3 files changed, 19 insertions(+), 23 deletions(-)
diff --git a/src/input/vlm.c b/src/input/vlm.c
index 650d87f..fc63d21 100644
--- a/src/input/vlm.c
+++ b/src/input/vlm.c
@@ -105,9 +105,9 @@ static int InputEvent( vlc_object_t *p_this, char const *psz_cmd,
}
vlm_SendEventMediaInstanceState( p_vlm, p_media->cfg.id, p_media->cfg.psz_name, psz_instance_name, var_GetInteger( p_input, "state" ) );
- vlc_mutex_lock( &p_vlm->lock_manage );
- vlc_cond_signal( &p_vlm->wait_manage );
- vlc_mutex_unlock( &p_vlm->lock_manage );
+ vlc_mutex_lock( &p_vlm->lock );
+ vlc_cond_signal( &p_vlm->wait );
+ vlc_mutex_unlock( &p_vlm->lock );
}
return VLC_SUCCESS;
}
@@ -146,8 +146,8 @@ vlm_t *vlm_New ( vlc_object_t *p_this )
}
vlc_mutex_init( &p_vlm->lock );
- vlc_mutex_init( &p_vlm->lock_manage );
- vlc_cond_init_daytime( &p_vlm->wait_manage );
+ vlc_mutex_init( &p_vlm->lock );
+ vlc_cond_init_daytime( &p_vlm->wait );
p_vlm->i_id = 1;
TAB_INIT( p_vlm->i_media, p_vlm->media );
TAB_INIT( p_vlm->i_schedule, p_vlm->schedule );
@@ -158,8 +158,8 @@ vlm_t *vlm_New ( vlc_object_t *p_this )
if( vlc_clone( &p_vlm->thread, Manage, p_vlm, VLC_THREAD_PRIORITY_LOW ) )
{
- vlc_cond_destroy( &p_vlm->wait_manage );
- vlc_mutex_destroy( &p_vlm->lock_manage );
+ vlc_cond_destroy( &p_vlm->wait );
+ vlc_mutex_destroy( &p_vlm->lock );
vlc_mutex_destroy( &p_vlm->lock );
vlc_object_release( p_vlm );
vlc_mutex_unlock( &vlm_mutex );
@@ -218,17 +218,17 @@ static void vlm_Destructor( vlm_t *p_vlm )
vlm_ControlInternal( p_vlm, VLM_CLEAR_SCHEDULES );
TAB_CLEAN( p_vlm->schedule, p_vlm->schedule );
- vlc_mutex_lock( &p_vlm->lock_manage );
- vlc_cond_signal( &p_vlm->wait_manage );
- vlc_mutex_unlock( &p_vlm->lock_manage );
+ vlc_mutex_lock( &p_vlm->lock );
+ vlc_cond_signal( &p_vlm->wait );
+ vlc_mutex_unlock( &p_vlm->lock );
libvlc_priv(p_vlm->p_libvlc)->p_vlm = NULL;
vlc_object_kill( p_vlm );
/*vlc_cancel( p_vlm->thread ); */
vlc_join( p_vlm->thread, NULL );
- vlc_cond_destroy( &p_vlm->wait_manage );
- vlc_mutex_destroy( &p_vlm->lock_manage );
+ vlc_cond_destroy( &p_vlm->wait );
+ vlc_mutex_destroy( &p_vlm->lock );
vlc_mutex_destroy( &p_vlm->lock );
}
@@ -373,14 +373,11 @@ static void* Manage( void* p_object )
char **ppsz_scheduled_commands = NULL;
int i_scheduled_commands = 0;
- vlc_mutex_lock( &vlm->lock_manage );
+ vlc_mutex_lock( &vlm->lock );
if( i_nextschedule )
- vlc_cond_timedwait( &vlm->wait_manage, &vlm->lock_manage, i_nextschedule );
+ vlc_cond_timedwait( &vlm->wait, &vlm->lock, i_nextschedule );
else
- vlc_cond_wait( &vlm->wait_manage, &vlm->lock_manage );
- vlc_mutex_unlock( &vlm->lock_manage );
-
- vlc_mutex_lock( &vlm->lock );
+ vlc_cond_wait( &vlm->wait, &vlm->lock );
/* destroy the inputs that wants to die, and launch the next input */
for( i = 0; i < vlm->i_media; i++ )
diff --git a/src/input/vlm_internal.h b/src/input/vlm_internal.h
index 7d4c48e..fdd60d4 100644
--- a/src/input/vlm_internal.h
+++ b/src/input/vlm_internal.h
@@ -90,8 +90,7 @@ struct vlm_t
vlc_mutex_t lock;
vlc_thread_t thread;
- vlc_mutex_t lock_manage;
- vlc_cond_t wait_manage;
+ vlc_cond_t wait;
/* */
int64_t i_id;
diff --git a/src/input/vlmshell.c b/src/input/vlmshell.c
index db5d005..27c97e0 100644
--- a/src/input/vlmshell.c
+++ b/src/input/vlmshell.c
@@ -665,9 +665,9 @@ static int ExecuteScheduleProperty( vlm_t *p_vlm, vlm_schedule_sys_t *p_schedule
}
*pp_status = vlm_MessageSimpleNew( psz_cmd );
- vlc_mutex_lock( &p_vlm->lock_manage );
- vlc_cond_signal( &p_vlm->wait_manage );
- vlc_mutex_unlock( &p_vlm->lock_manage );
+ vlc_mutex_lock( &p_vlm->lock );
+ vlc_cond_signal( &p_vlm->wait );
+ vlc_mutex_unlock( &p_vlm->lock );
return VLC_SUCCESS;
More information about the vlc-devel
mailing list