class WQueue: method 'T remove(const long delay)' removed.

This commit is contained in:
Roland Jax
2014-06-21 15:34:18 +02:00
parent 081f1eefe7
commit da2d943fce
3 changed files with 25 additions and 72 deletions
-31
View File
@@ -21,10 +21,7 @@
#define WQUEUE_H_
#include <list>
#include <ctime>
#include <pthread.h>
#include <sys/time.h>
#include <errno.h>
template <typename T> class WQueue
{
@@ -67,34 +64,6 @@ public:
return item;
}
T remove(const long delay)
{
struct timeval tv;
struct timezone tz;
struct timespec timeout;
int ret = 0;
pthread_mutex_lock(&m_mutex);
gettimeofday(&tv, &tz);
timeout.tv_sec = tv.tv_sec + delay;
timeout.tv_nsec = tv.tv_usec * 1000;
while (m_queue.size() == 0 && ret != ETIMEDOUT)
ret = pthread_cond_timedwait(&m_condv, &m_mutex, &timeout);
if (ret == ETIMEDOUT)
return NULL;
T item = m_queue.front();
m_queue.pop_front();
pthread_mutex_unlock(&m_mutex);
return item;
}
int size()
{
pthread_mutex_lock(&m_mutex);