[vlc-devel] commit: Extensions: remove timers ( Jean-Philippe André )
git version control
git at videolan.org
Thu Jan 28 16:22:14 CET 2010
vlc | branch: master | Jean-Philippe André <jpeg at videolan.org> | Thu Jan 28 11:20:38 2010 +0100| [dbd4f0ccd58df3c9b4825b1f3c1b4a9806b20cdd] | committer: Jean-Philippe André
Extensions: remove timers
Clean Extension dialogs and widgets without using a cond_timedwait but
a simple cond_wait instead.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=dbd4f0ccd58df3c9b4825b1f3c1b4a9806b20cdd
---
modules/misc/lua/libs/dialog.c | 31 +++++++++++--------------------
1 files changed, 11 insertions(+), 20 deletions(-)
diff --git a/modules/misc/lua/libs/dialog.c b/modules/misc/lua/libs/dialog.c
index d0702c3..e8dc5e2 100644
--- a/modules/misc/lua/libs/dialog.c
+++ b/modules/misc/lua/libs/dialog.c
@@ -241,8 +241,7 @@ static int vlclua_dialog_delete( lua_State *L )
vlc_mutex_lock( &p_dlg->lock );
while( p_dlg->p_sys_intf != NULL )
{
- mtime_t abstime = mdate() + 1000000; // Waiting 1 second at a time
- vlc_cond_timedwait( &p_dlg->cond, &p_dlg->lock, abstime );
+ vlc_cond_wait( &p_dlg->cond, &p_dlg->lock );
}
vlc_mutex_unlock( &p_dlg->lock );
@@ -833,29 +832,21 @@ static int vlclua_dialog_delete_widget( lua_State *L )
vlc_mutex_lock( &p_dlg->lock );
/* Same remarks as for dialog delete */
- mtime_t abstime = mdate() + 2000000;
- if( p_widget->p_sys_intf != NULL )
- vlc_cond_timedwait( &p_dlg->cond, &p_dlg->lock, abstime );
-
- if( p_widget->p_sys_intf == NULL )
- {
- i_ret = DeleteWidget( p_dlg, p_widget );
-
- if( i_ret != VLC_SUCCESS )
- {
- vlc_mutex_unlock( &p_dlg->lock );
- return luaL_error( L, "Could not remove widget from list" );
- }
- }
- else
+ while( p_widget->p_sys_intf != NULL )
{
- msg_Warn( p_mgr, "Could not delete a widget. Leaking its descriptor." );
- i_ret = VLC_EGENERIC;
+ vlc_cond_wait( &p_dlg->cond, &p_dlg->lock );
}
+ i_ret = DeleteWidget( p_dlg, p_widget );
+
vlc_mutex_unlock( &p_dlg->lock );
- return ( i_ret == VLC_SUCCESS ) ? 1 : 0;
+ if( i_ret != VLC_SUCCESS )
+ {
+ return luaL_error( L, "Could not remove widget from list" );
+ }
+
+ return 1;
}
More information about the vlc-devel
mailing list