[vlc-commits] Revert "upnp: fix deadlock when calling UpnpFinish locked"
Thomas Guillem
git at videolan.org
Mon Feb 8 18:20:47 CET 2016
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Feb 8 16:38:51 2016 +0100| [72c84ba4b3b2a830236841cce6f58681615140d8] | committer: Thomas Guillem
Revert "upnp: fix deadlock when calling UpnpFinish locked"
This reverts commit 7e11257c2823417b582f4e4ad3108dce7c4c372e.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=72c84ba4b3b2a830236841cce6f58681615140d8
---
modules/services_discovery/upnp.cpp | 16 +---------------
modules/services_discovery/upnp.hpp | 1 -
2 files changed, 1 insertion(+), 16 deletions(-)
diff --git a/modules/services_discovery/upnp.cpp b/modules/services_discovery/upnp.cpp
index 0aaed99..5e7c2a1 100644
--- a/modules/services_discovery/upnp.cpp
+++ b/modules/services_discovery/upnp.cpp
@@ -74,7 +74,6 @@ struct access_sys_t
UpnpInstanceWrapper* UpnpInstanceWrapper::s_instance;
vlc_mutex_t UpnpInstanceWrapper::s_lock = VLC_STATIC_MUTEX;
-vlc_cond_t UpnpInstanceWrapper::s_cond = VLC_STATIC_COND;
/*
* VLC callback prototypes
@@ -1079,12 +1078,6 @@ UpnpInstanceWrapper::~UpnpInstanceWrapper()
UpnpInstanceWrapper *UpnpInstanceWrapper::get(vlc_object_t *p_obj, Upnp_FunPtr callback, SD::MediaServerList *opaque)
{
vlc_mutex_locker lock( &s_lock );
-
- /* refcount is 0 but instance is not NULL, UpnpFinish is being called so
- * wait for it to finish */
- while ( s_instance != NULL && s_instance->refcount_ == 0 )
- vlc_cond_wait( &s_cond, &s_lock );
-
if ( s_instance == NULL )
{
UpnpInstanceWrapper* instance = new(std::nothrow) UpnpInstanceWrapper;
@@ -1143,7 +1136,7 @@ UpnpInstanceWrapper *UpnpInstanceWrapper::get(vlc_object_t *p_obj, Upnp_FunPtr c
void UpnpInstanceWrapper::release(bool isSd)
{
- vlc_mutex_lock( &s_lock );
+ vlc_mutex_locker lock( &s_lock );
if ( isSd )
{
callback_ = NULL;
@@ -1151,16 +1144,9 @@ void UpnpInstanceWrapper::release(bool isSd)
}
if (--s_instance->refcount_ == 0)
{
- vlc_mutex_unlock( &s_lock );
- /* UpnpFinish must be called unlocked since callbacks can still be
- * called when shuting down upnp threads */
delete s_instance;
- vlc_mutex_lock( &s_lock );
-
s_instance = NULL;
- vlc_cond_signal( &s_cond );
}
- vlc_mutex_unlock( &s_lock );
}
UpnpClient_Handle UpnpInstanceWrapper::handle() const
diff --git a/modules/services_discovery/upnp.hpp b/modules/services_discovery/upnp.hpp
index a6d720f..0cdbd8d 100644
--- a/modules/services_discovery/upnp.hpp
+++ b/modules/services_discovery/upnp.hpp
@@ -71,7 +71,6 @@ private:
private:
static UpnpInstanceWrapper* s_instance;
static vlc_mutex_t s_lock;
- static vlc_cond_t s_cond;
UpnpClient_Handle handle_;
SD::MediaServerList* opaque_;
Upnp_FunPtr callback_;
More information about the vlc-commits
mailing list