[vlc-devel] commit: lua_libs: lock the mutex when reading the stats of an item. ( Rémi Duraffort )

git version control git at videolan.org
Mon Nov 16 20:14:20 CET 2009


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Mon Nov 16 19:54:37 2009 +0100| [a5120fbebe4a279684fa1b9bb403d2b0362a42ef] | committer: Rémi Duraffort 

lua_libs: lock the mutex when reading the stats of an item.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a5120fbebe4a279684fa1b9bb403d2b0362a42ef
---

 modules/misc/lua/libs/input.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/modules/misc/lua/libs/input.c b/modules/misc/lua/libs/input.c
index b16c4e7..ef6ee9a 100644
--- a/modules/misc/lua/libs/input.c
+++ b/modules/misc/lua/libs/input.c
@@ -167,6 +167,7 @@ static int vlclua_input_stats( lua_State *L )
     lua_newtable( L );
     if( p_item )
     {
+        vlc_mutex_lock( &p_item->p_stats->lock );
 #define STATS_INT( n ) lua_pushinteger( L, p_item->p_stats->i_ ## n ); \
                        lua_setfield( L, -2, #n );
 #define STATS_FLOAT( n ) lua_pushnumber( L, p_item->p_stats->f_ ## n ); \
@@ -186,6 +187,7 @@ static int vlclua_input_stats( lua_State *L )
         STATS_FLOAT( send_bitrate )
 #undef STATS_INT
 #undef STATS_FLOAT
+        vlc_mutex_unlock( &p_item->p_stats->lock );
     }
     if( p_input )
         vlc_object_release( p_input );




More information about the vlc-devel mailing list