Switch to side-by-side view

--- a/libupnpp/workqueue.hxx
+++ b/libupnpp/workqueue.hxx
@@ -29,13 +29,6 @@
 using std::queue;
 using std::string;
 
-//#include "debuglog.h"
-#define LOGDEB2(X)
-#define LOGDEB1(X)
-#define LOGDEB0(X)
-#define LOGDEB(X)
-#define LOGINFO(X)
-#define LOGERR(X)
 #include "ptmutex.hxx"
 
 /// Store per-worker-thread data. Just an initialized timespec, and
@@ -79,7 +72,6 @@
 
 	~WorkQueue()
 	{
-		LOGDEB2(("WorkQueue::~WorkQueue:%s\n", m_name.c_str()));
 		if (!m_worker_threads.empty())
 			setTerminateAndWait();
 	}
@@ -99,8 +91,6 @@
 			int err;
 			pthread_t thr;
 			if ((err = pthread_create(&thr, 0, workproc, arg))) {
-				LOGERR(("WorkQueue:%s: pthread_create failed, err %d\n",
-						m_name.c_str(), err));
 				return false;
 			}
 			m_worker_threads.insert(pair<pthread_t, WQTData>(thr, WQTData()));
@@ -116,8 +106,6 @@
 	{
 		PTMutexLocker lock(m_mutex);
 		if (!lock.ok() || !ok()) {
-		LOGERR(("WorkQueue::put:%s: !ok or mutex_lock failed\n",
-			m_name.c_str()));
 			return false;
 		}
 
@@ -163,8 +151,6 @@
 	{
 		PTMutexLocker lock(m_mutex);
 		if (!lock.ok() || !ok()) {
-			LOGERR(("WorkQueue::waitIdle:%s: not ok or can't lock\n",
-					m_name.c_str()));
 			return false;
 		}
 
@@ -176,8 +162,6 @@
 			if (pthread_cond_wait(&m_ccond, lock.getMutex())) {
 				m_clients_waiting--;
 				m_ok = false;
-				LOGERR(("WorkQueue::waitIdle:%s: cond_wait failed\n",
-						m_name.c_str()));
 				return false;
 			}
 			m_clients_waiting--;
@@ -195,7 +179,6 @@
 	void* setTerminateAndWait()
 	{
 		PTMutexLocker lock(m_mutex);
-		LOGDEB(("setTerminateAndWait:%s\n", m_name.c_str()));
 
 		if (m_worker_threads.empty()) {
 			// Already called ?
@@ -208,17 +191,12 @@
 			pthread_cond_broadcast(&m_wcond);
 			m_clients_waiting++;
 			if (pthread_cond_wait(&m_ccond, lock.getMutex())) {
-				LOGERR(("WorkQueue::setTerminate:%s: cond_wait failed\n",
-						m_name.c_str()));
 				m_clients_waiting--;
 				return (void*)0;
 			}
 			m_clients_waiting--;
 		}
 
-		LOGINFO(("%s: tasks %u nowakes %u wsleeps %u csleeps %u\n",
-				 m_name.c_str(), m_tottasks, m_nowake, m_workersleeps,
-				 m_clientsleeps));
 		// Perform the thread joins and compute overall status
 		// Workers return (void*)1 if ok
 		void *statusall = (void*)1;
@@ -237,7 +215,6 @@
 			m_tottasks = m_nowake = m_workersleeps = m_clientsleeps = 0;
 		m_ok = true;
 
-		LOGDEB(("setTerminateAndWait:%s done\n", m_name.c_str()));
 		return statusall;
 	}
 
@@ -250,7 +227,6 @@
 	{
 		PTMutexLocker lock(m_mutex);
 		if (!lock.ok() || !ok()) {
-			LOGDEB(("WorkQueue::take:%s: not ok\n", m_name.c_str()));
 			return false;
 		}
 
@@ -260,11 +236,6 @@
 			if (m_queue.empty())
 				pthread_cond_broadcast(&m_ccond);
 			if (pthread_cond_wait(&m_wcond, lock.getMutex()) || !ok()) {
-				// !ok is a normal condition when shutting down
-				if (ok()) {
-					LOGERR(("WorkQueue::take:%s: cond_wait failed or !ok\n",
-							m_name.c_str()));
-				}
 				m_workers_waiting--;
 				return false;
 			}
@@ -295,7 +266,6 @@
 	 */
 	void workerExit()
 	{
-		LOGDEB(("workerExit:%s\n", m_name.c_str()));
 		PTMutexLocker lock(m_mutex);
 		m_workers_exited++;
 		m_ok = false;
@@ -313,11 +283,6 @@
 	bool ok()
 	{
 		bool isok = m_ok && m_workers_exited == 0 && !m_worker_threads.empty();
-		if (!isok) {
-			LOGDEB(("WorkQueue:ok:%s: not ok m_ok %d m_workers_exited %d "
-					"m_worker_threads size %d\n", m_name.c_str(),
-					m_ok, m_workers_exited, int(m_worker_threads.size())));
-		}
 		return isok;
 	}