Index: libs/libmythupnp/threadpool.h
===================================================================
--- libs/libmythupnp/threadpool.h	(revision 15096)
+++ libs/libmythupnp/threadpool.h	(working copy)
@@ -63,10 +63,10 @@
 
         CEvent              m_Initialized;
         bool                m_bInitialized;
-                         
+
         ThreadPool         *m_pThreadPool;
 
-        bool                m_bTermRequested;
+        volatile bool       m_bTermRequested;
         QString             m_sName;
 
         long                m_nIdleTimeoutMS;
@@ -78,15 +78,12 @@
         virtual void  run();
         virtual void  ProcessWork() = 0;
 
-        bool    IsTermRequested     ();
-
     public:
 
                  WorkerThread( ThreadPool *pThreadPool, const QString &sName );
         virtual ~WorkerThread();
 
         bool     WaitForInitialized( unsigned long msecs );
-        void     RequestTerminate  ();
         void     SignalWork        ();
         void     SetTimeout        ( long nIdleTimeout );
 
Index: libs/libmythupnp/httpserver.cpp
===================================================================
--- libs/libmythupnp/httpserver.cpp	(revision 15096)
+++ libs/libmythupnp/httpserver.cpp	(working copy)
@@ -239,7 +239,7 @@
 
         pSocket->SocketDevice()->setBlocking( true );
 
-        while( !IsTermRequested() && bKeepAlive && pSocket->IsValid())
+        while( !m_bTermRequested && bKeepAlive && pSocket->IsValid())
         {
             bTimeout = 0;
 
Index: libs/libmythupnp/taskqueue.cpp
===================================================================
--- libs/libmythupnp/taskqueue.cpp	(revision 15096)
+++ libs/libmythupnp/taskqueue.cpp	(working copy)
@@ -38,9 +38,7 @@
 
 Task::Task()
 {
-    m_mutex.lock();
     m_nTaskId = m_nTaskCount++;
-    m_mutex.unlock();
 }
 
 /////////////////////////////////////////////////////////////////////////////
@@ -74,35 +72,11 @@
 
 TaskQueue::~TaskQueue()
 {
-    Clear();
-}
-
-/////////////////////////////////////////////////////////////////////////////
-//
-/////////////////////////////////////////////////////////////////////////////
-
-bool TaskQueue::IsTermRequested()
-{
-    m_mutex.lock();
-    bool bTermRequested = m_bTermRequested;
-    m_mutex.unlock();
-
-    return( bTermRequested );
-}
-
-/////////////////////////////////////////////////////////////////////////////
-//
-/////////////////////////////////////////////////////////////////////////////
-
-void TaskQueue::RequestTerminate( )
-{
-    m_mutex.lock();  
     m_bTermRequested = true; 
-    m_mutex.unlock();
 
-    // Wait for thread to terminate.
+    wait();
 
-    wait( 1000 );
+    Clear();
 }
 
 /////////////////////////////////////////////////////////////////////////////
@@ -113,7 +87,7 @@
 {
     Task *pTask;
 
-    while ( !IsTermRequested() )
+    while ( !m_bTermRequested )
     {
         // ------------------------------------------------------------------
         // Process Any Tasks that may need to be executed.
Index: libs/libmythupnp/ssdp.cpp
===================================================================
--- libs/libmythupnp/ssdp.cpp	(revision 15096)
+++ libs/libmythupnp/ssdp.cpp	(working copy)
@@ -67,6 +67,10 @@
 {
     DisableNotifications();
 
+    m_bTermRequested = true; 
+
+    wait();
+
     if (m_pNotifyTask != NULL)
         m_pNotifyTask->Release();
 
@@ -83,34 +87,6 @@
 //
 /////////////////////////////////////////////////////////////////////////////
 
-bool SSDP::IsTermRequested()
-{
-    m_lock.lock();
-    bool bTermRequested = m_bTermRequested;
-    m_lock.unlock();
-
-    return( bTermRequested );
-}
-
-/////////////////////////////////////////////////////////////////////////////
-//
-/////////////////////////////////////////////////////////////////////////////
-
-void SSDP::RequestTerminate(void)
-{
-    m_lock.lock();  
-    m_bTermRequested = true; 
-    m_lock.unlock();
-
-    // Call wait to give thread time to terminate.
-
-    wait( 500 );
-}
-
-/////////////////////////////////////////////////////////////////////////////
-//
-/////////////////////////////////////////////////////////////////////////////
-
 void SSDP::EnableNotifications()
 {
     if ( m_pNotifyTask == NULL )
@@ -202,7 +178,7 @@
     // Listen for new Requests
     // ----------------------------------------------------------------------
 
-    while (!IsTermRequested())
+    while (!m_bTermRequested)
     {
         int nMaxSocket = 0;
 
Index: libs/libmythupnp/upnp.cpp
===================================================================
--- libs/libmythupnp/upnp.cpp	(revision 15096)
+++ libs/libmythupnp/upnp.cpp	(working copy)
@@ -165,20 +165,12 @@
 
     if (g_pTaskQueue)
     {
-        g_pTaskQueue->Clear();
-        g_pTaskQueue->RequestTerminate();
-
         delete g_pTaskQueue;
         g_pTaskQueue = NULL;
     }
 
     if (g_pSSDP)
     {
-        VERBOSE(VB_UPNP, "UPnp::CleanUp() - disabling SSDP notifications");
-        g_pSSDP->DisableNotifications();
-        VERBOSE(VB_UPNP, "UPnp::CleanUp() - requesting SSDP terminate");
-        g_pSSDP->RequestTerminate();
-
         delete g_pSSDP;
         g_pSSDP = NULL;
         VERBOSE(VB_UPNP, "UPnp::CleanUp() - deleted SSDP");
Index: libs/libmythupnp/threadpool.cpp
===================================================================
--- libs/libmythupnp/threadpool.cpp	(revision 15096)
+++ libs/libmythupnp/threadpool.cpp	(working copy)
@@ -129,19 +129,11 @@
 
 WorkerThread::~WorkerThread()
 {
-}
+    m_bTermRequested = true; 
 
-/////////////////////////////////////////////////////////////////////////////
-//
-/////////////////////////////////////////////////////////////////////////////
+    m_WorkAvailable.SetEvent();
 
-bool WorkerThread::IsTermRequested()
-{
-    m_mutex.lock();
-    bool bTermRequested = m_bTermRequested;
-    m_mutex.unlock();
-
-    return( bTermRequested );
+    wait();
 }
 
 /////////////////////////////////////////////////////////////////////////////
@@ -164,23 +156,6 @@
 //
 /////////////////////////////////////////////////////////////////////////////
 
-void WorkerThread::RequestTerminate()
-{
-    m_mutex.lock();  
-    m_bTermRequested = true; 
-    m_mutex.unlock();
-
-    m_WorkAvailable.SetEvent();
-
-    // Give time for thread to terminate.
-
-    wait( 500 );
-}
-
-/////////////////////////////////////////////////////////////////////////////
-//
-/////////////////////////////////////////////////////////////////////////////
-
 void WorkerThread::SignalWork()
 {
     m_WorkAvailable.SetEvent();
@@ -219,7 +194,7 @@
 
     timer.start();
 
-    while( !IsTermRequested() )
+    while( !m_bTermRequested )
     {
         if (m_bAllowTimeout && (timer.elapsed() > m_nIdleTimeoutMS) )
             break;
@@ -228,7 +203,7 @@
         {
             m_WorkAvailable.ResetEvent();
 
-            if ( !IsTermRequested() )
+            if ( !m_bTermRequested )
             {
                 try
                 {
@@ -307,8 +282,6 @@
 
         if (pThread != NULL)
         {
-            pThread->RequestTerminate();
-
             delete pThread;
         }
 
Index: libs/libmythupnp/taskqueue.h
===================================================================
--- libs/libmythupnp/taskqueue.h	(revision 15096)
+++ libs/libmythupnp/taskqueue.h	(working copy)
@@ -73,14 +73,12 @@
 {
     protected:
 
-        TaskMap     m_mapTasks;
-        QMutex      m_mutex;
-        bool        m_bTermRequested;
+        TaskMap             m_mapTasks;
+        QMutex              m_mutex;
+        volatile bool       m_bTermRequested;
 
     protected:
 
-        bool  IsTermRequested();
-
         virtual void run    ();
 
     public:
@@ -88,15 +86,13 @@
                  TaskQueue();
         virtual ~TaskQueue();
 
-        void  RequestTerminate   ( );
-
         void  Clear              ( );
         void  AddTask            ( long msec  , Task *pTask );
         void  AddTask            ( TaskTime tt, Task *pTask );
         void  AddTask            ( Task *pTask );
-                                                          
+
         Task *GetNextExpiredTask ( TaskTime tt, long nWithinMilliSecs = 50 );
-                                                                
+
 };
 
 #endif
Index: libs/libmythupnp/ssdp.h
===================================================================
--- libs/libmythupnp/ssdp.h	(revision 15096)
+++ libs/libmythupnp/ssdp.h	(working copy)
@@ -68,7 +68,7 @@
 
         UPnpNotifyTask     *m_pNotifyTask;
 
-        bool                m_bTermRequested;
+        volatile bool       m_bTermRequested;
         QMutex              m_lock;
 
     protected:
@@ -79,8 +79,6 @@
         bool    ProcessSearchResponse( const QStringMap &sHeaders );
         bool    ProcessNotify        ( const QStringMap &sHeaders );
 
-        bool    IsTermRequested      ();
-
         QString GetHeaderValue    ( const QStringMap &headers, 
                                     const QString    &sKey, 
                                     const QString    &sDefault );
@@ -96,8 +94,6 @@
 
         virtual void run    ();
 
-                void RequestTerminate(void);
-
                 void EnableNotifications ();
                 void DisableNotifications();
 
