Commit 723515cd authored by Rémi Duraffort's avatar Rémi Duraffort

Use vlc_mutex_locker

parent bbbd014a
...@@ -49,7 +49,7 @@ struct services_discovery_sys_t ...@@ -49,7 +49,7 @@ struct services_discovery_sys_t
{ {
UpnpClient_Handle clientHandle; UpnpClient_Handle clientHandle;
MediaServerList* serverList; MediaServerList* serverList;
Lockable* callbackLock; vlc_mutex_t callbackLock;
}; };
// VLC callback prototypes // VLC callback prototypes
...@@ -99,7 +99,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -99,7 +99,7 @@ static int Open( vlc_object_t *p_this )
} }
p_sys->serverList = new MediaServerList( p_sd ); 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 ); res = UpnpRegisterClient( Callback, p_sd, &p_sys->clientHandle );
if( res != UPNP_E_SUCCESS ) if( res != UPNP_E_SUCCESS )
...@@ -128,7 +128,7 @@ static void Close( vlc_object_t *p_this ) ...@@ -128,7 +128,7 @@ static void Close( vlc_object_t *p_this )
UpnpFinish(); UpnpFinish();
delete p_sd->p_sys->serverList; 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 ); free( p_sd->p_sys );
} }
...@@ -194,7 +194,7 @@ static int Callback( Upnp_EventType eventType, void* event, void* user_data ) ...@@ -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_t *p_sd = ( services_discovery_t* ) user_data;
services_discovery_sys_t* p_sys = p_sd->p_sys; services_discovery_sys_t* p_sys = p_sd->p_sys;
Locker locker( p_sys->callbackLock ); vlc_mutex_locker locker( &p_sys->callbackLock );
switch( eventType ) { switch( eventType ) {
......
...@@ -36,49 +36,6 @@ ...@@ -36,49 +36,6 @@
// Classes // Classes
class Container; 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 class MediaServer
{ {
public: public:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment