[vlc-devel] commit: Moved static lock inside Cookie. (Laurent Aimar )

git version control git at videolan.org
Mon Aug 25 18:43:49 CEST 2008


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Mon Aug 25 18:43:35 2008 +0200| [d3a659d91bf01316857e5abd04935ac7b22edb79] | committer: Laurent Aimar 

Moved static lock inside Cookie.

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

 modules/services_discovery/upnp_intel.cpp |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/modules/services_discovery/upnp_intel.cpp b/modules/services_discovery/upnp_intel.cpp
index 0c3f3a5..bb23092 100644
--- a/modules/services_discovery/upnp_intel.cpp
+++ b/modules/services_discovery/upnp_intel.cpp
@@ -77,6 +77,7 @@ typedef struct
     services_discovery_t* serviceDiscovery;
     UpnpClient_Handle clientHandle;
     MediaServerList* serverList;
+    Lockable* lock;
 } Cookie;
 
 
@@ -275,7 +276,6 @@ vlc_module_end();
 
 // More prototypes...
 
-static Lockable* CallbackLock;
 static int Callback( Upnp_EventType eventType, void* event, void* pCookie );
 
 const char* xml_getChildElementValue( IXML_Element* parent, const char* tagName );
@@ -333,8 +333,7 @@ static void Run( services_discovery_t* p_sd )
     Cookie cookie;
     cookie.serviceDiscovery = p_sd;
     cookie.serverList = new MediaServerList( &cookie );
-
-    CallbackLock = new Lockable( &cookie );
+    cookie.lock = new Lockable();
 
     res = UpnpRegisterClient( Callback, &cookie, &cookie.clientHandle );
     if( res != UPNP_E_SUCCESS )
@@ -361,7 +360,7 @@ static void Run( services_discovery_t* p_sd )
  shutDown:
     UpnpFinish();
     delete cookie.serverList;
-    delete CallbackLock;
+    delete cookie.lock;
 }
 
 
@@ -419,10 +418,10 @@ IXML_Document* parseBrowseResult( IXML_Document* doc )
 // Handles all UPnP events
 static int Callback( Upnp_EventType eventType, void* event, void* pCookie )
 {
-    Locker locker( CallbackLock );
-
     Cookie* cookie = ( Cookie* )pCookie;
 
+    Locker locker( cookie->lock );
+
     switch( eventType ) {
 
     case UPNP_DISCOVERY_ADVERTISEMENT_ALIVE:




More information about the vlc-devel mailing list