From 0e37486f23cde2d9238217a4c646183582a06871 Mon Sep 17 00:00:00 2001
From: Fu Juntang <StrongTiger_001@163.com>
Date: 星期日, 26 九月 2021 14:16:37 +0800
Subject: [PATCH] Add the parsing protobuf data head file.
---
src/queue/shm_queue.h | 44 ++++----------------------------------------
1 files changed, 4 insertions(+), 40 deletions(-)
diff --git a/src/queue/shm_queue.h b/src/queue/shm_queue.h
index 24a4dfc..f5d64db 100644
--- a/src/queue/shm_queue.h
+++ b/src/queue/shm_queue.h
@@ -40,13 +40,11 @@
bool full();
bool empty();
- int push(const ELEM_T &a_data, const struct timespec *timeout=NULL, int flag=0);
- int pop(ELEM_T &a_data, const struct timespec *timeout=NULL, int flag=0);
+ int push(const ELEM_T &a_data, const struct timespec *timeout = NULL, int flag = 0);
+ int pop(ELEM_T &a_data, const struct timespec *timeout = NULL, int flag = 0);
ELEM_T &operator[](unsigned i);
- // @deprecate
- static size_t remove_queues_exclude(int keys[], size_t length);
private:
protected:
@@ -60,34 +58,7 @@
SHMQueue<ELEM_T>(const SHMQueue<ELEM_T> &a_src);
};
-// @deprecate
-// template <typename ELEM_T>
-// size_t SHMQueue<ELEM_T>::remove_queues_exclude(int keys[], size_t length) {
-// hashtable_t *hashtable = mm_get_hashtable();
-// std::set<int> *keyset = hashtable_keyset(hashtable);
-// std::set<int>::iterator keyItr;
-// LockFreeQueue<ELEM_T, SHM_Allocator> *mqueue;
-// bool found;
-// size_t count = 0;
-// for (keyItr = keyset->begin(); keyItr != keyset->end(); keyItr++) {
-// found = false;
-// for (size_t i = 0; i < length; i++) {
-// if (*keyItr == keys[i]) {
-// found = true;
-// break;
-// }
-// }
-// if (!found && *keyItr > 100) {
-// // 閿�姣佸叡浜唴瀛樼殑queue
-// mqueue = (LockFreeQueue<ELEM_T, SHM_Allocator> *)hashtable_get(hashtable, *keyItr);
-// delete mqueue;
-// hashtable_remove(hashtable, *keyItr);
-// count++;
-// }
-// }
-// delete keyset;
-// return count;
-// }
+
@@ -108,10 +79,7 @@
template <typename ELEM_T> SHMQueue<ELEM_T>::~SHMQueue() {
LoggerFactory::getLogger()->debug("SHMQueue destroy");
- if(owner) {
- delete queue;
- hashtable_remove(hashtable, mkey);
- }
+
}
@@ -119,19 +87,15 @@
template <typename ELEM_T>
bool SHMQueue<ELEM_T>::bind(int key, bool force) {
-
- hashtable_lock(hashtable);
void *tmp_ptr = hashtable_get(hashtable, key);
if (tmp_ptr == NULL || tmp_ptr == (void *)1 || force) {
queue = new LockFreeQueue<ELEM_T, SHM_Allocator>(mqsize);
hashtable_put(hashtable, key, (void *)queue);
mkey = key;
owner = true;
- hashtable_unlock(hashtable);
return true;
}
- hashtable_unlock(hashtable);
return false;
}
--
Gitblit v1.8.0