summaryrefslogtreecommitdiff
path: root/src/threadsafe_queue.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/threadsafe_queue.h')
-rw-r--r--src/threadsafe_queue.h20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/threadsafe_queue.h b/src/threadsafe_queue.h
index 616e81e..b6d5725 100644
--- a/src/threadsafe_queue.h
+++ b/src/threadsafe_queue.h
@@ -28,29 +28,31 @@
#ifndef __MIAV_THREADSAFE_QUEUE_H__
#define __MIAV_THREADSAFE_QUEUE_H__
-#include <pthread.h>
-#include <semaphore.h>
+#include "mutex.h"
+#include "semaphore.h"
template <typename T>
class ThreadSafeQueue {
public:
ThreadSafeQueue() {
- pthread_mutex_init (&mutex, NULL);
- sem_init(&semaphore, 0, 0);
+ // pthread_mutex_init (&mutex, NULL);
+ // sem_init(&semaphore, 0, 0);
}
virtual ~ThreadSafeQueue() {
- pthread_mutex_destroy(&mutex);
- sem_destroy(&semaphore);
+ // pthread_mutex_destroy(&mutex);
+ //sem_destroy(&semaphore);
}
virtual void push(T t) = 0;
virtual T pop() = 0;
virtual int size() = 0;
- //protected:
- pthread_mutex_t mutex;
- sem_t semaphore;
+protected:
+ // pthread_mutex_t mutex;
+ Mutex mutex;
+ //sem_t semaphore;
+ Semaphore semaphore;
};
#endif/*__MIAV_THREADSAFE_QUEUE_H__*/