[vlc-devel] commit: Use vlc_mutex_locker ( Rémi Duraffort )
git version control
git at videolan.org
Fri Jun 19 09:32:11 CEST 2009
vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Fri Jun 19 09:31:38 2009 +0200| [723515cdae4d546c88bdc5d094cd21d3225069d9] | committer: Rémi Duraffort
Use vlc_mutex_locker
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=723515cdae4d546c88bdc5d094cd21d3225069d9
---
modules/services_discovery/upnp_intel.cpp | 10 +++---
modules/services_discovery/upnp_intel.hpp | 43 -----------------------------
2 files changed, 5 insertions(+), 48 deletions(-)
diff --git a/modules/services_discovery/upnp_intel.cpp b/modules/services_discovery/upnp_intel.cpp
index f64a74b..53558b7 100644
--- a/modules/services_discovery/upnp_intel.cpp
+++ b/modules/services_discovery/upnp_intel.cpp
@@ -49,7 +49,7 @@ struct services_discovery_sys_t
{
UpnpClient_Handle clientHandle;
MediaServerList* serverList;
- Lockable* callbackLock;
+ vlc_mutex_t callbackLock;
};
// VLC callback prototypes
@@ -99,7 +99,7 @@ static int Open( vlc_object_t *p_this )
}
p_sys->serverList = new MediaServerList( p_sd );
- p_sys->callbackLock = new Lockable();
+ vlc_mutex_init( &p_sys->callbackLock );
res = UpnpRegisterClient( Callback, p_sd, &p_sys->clientHandle );
if( res != UPNP_E_SUCCESS )
@@ -111,7 +111,7 @@ static int Open( vlc_object_t *p_this )
res = UpnpSearchAsync( p_sys->clientHandle, 5,
MEDIA_SERVER_DEVICE_TYPE, p_sd );
-
+
if( res != UPNP_E_SUCCESS )
{
msg_Err( p_sd, "%s", UpnpGetErrorMessage( res ) );
@@ -128,7 +128,7 @@ static void Close( vlc_object_t *p_this )
UpnpFinish();
delete p_sd->p_sys->serverList;
- delete p_sd->p_sys->callbackLock;
+ vlc_mutex_destroy( &p_sd->p_sys->callbackLock );
free( p_sd->p_sys );
}
@@ -194,7 +194,7 @@ static int Callback( Upnp_EventType eventType, void* event, void* user_data )
{
services_discovery_t *p_sd = ( services_discovery_t* ) user_data;
services_discovery_sys_t* p_sys = p_sd->p_sys;
- Locker locker( p_sys->callbackLock );
+ vlc_mutex_locker locker( &p_sys->callbackLock );
switch( eventType ) {
diff --git a/modules/services_discovery/upnp_intel.hpp b/modules/services_discovery/upnp_intel.hpp
index f78e054..b699641 100644
--- a/modules/services_discovery/upnp_intel.hpp
+++ b/modules/services_discovery/upnp_intel.hpp
@@ -36,49 +36,6 @@
// Classes
class Container;
-
-class Lockable
-{
-public:
-
- Lockable()
- {
- vlc_mutex_init( &_mutex );
- }
-
- ~Lockable()
- {
- vlc_mutex_destroy( &_mutex );
- }
-
- void lock() { vlc_mutex_lock( &_mutex ); }
- void unlock() { vlc_mutex_unlock( &_mutex ); }
-
-private:
-
- vlc_mutex_t _mutex;
-};
-
-
-class Locker
-{
-public:
- Locker( Lockable* l )
- {
- _lockable = l;
- _lockable->lock();
- }
-
- ~Locker()
- {
- _lockable->unlock();
- }
-
-private:
- Lockable* _lockable;
-};
-
-
class MediaServer
{
public:
More information about the vlc-devel
mailing list