osaf/services/saf/amf/amfd/include/cb.h | 31 +------------------------------
osaf/services/saf/amf/amfd/main.cc | 8 ++++----
2 files changed, 5 insertions(+), 34 deletions(-)
Use std::queue instead of macro m_AVD_EVT_QUEUE_ENQUEUE and DEQUEUE
diff --git a/osaf/services/saf/amf/amfd/include/cb.h
b/osaf/services/saf/amf/amfd/include/cb.h
--- a/osaf/services/saf/amf/amfd/include/cb.h
+++ b/osaf/services/saf/amf/amfd/include/cb.h
@@ -96,12 +96,6 @@ typedef struct avd_evt_queue {
struct avd_evt_queue *next;
} AVD_EVT_QUEUE;
-typedef struct avd_evt_queue_list {
- AVD_EVT_QUEUE *evt_msg_queue;
- AVD_EVT_QUEUE *tail;
-} AVD_EVT_QUEUE_LIST;
-
-
/* AVD IMM Admin Operation Callback */
typedef struct admin_oper_cbk {
SaAmfAdminOperationIdT admin_oper;
@@ -158,7 +152,7 @@ typedef struct cl_cb_tag {
std::queue<AVSV_ND_MSG_QUEUE*> nd_msg_queue_list {};
/* Event Queue to hold the events during fail-over */
- AVD_EVT_QUEUE_LIST evt_queue;
+ std::queue<AVD_EVT_QUEUE*> evt_queue {};
/*
* MBCSv related variables.
*/
@@ -236,29 +230,6 @@ typedef struct cl_cb_tag {
} AVD_CL_CB;
-/* macro to enqueue the AVD events in the queue (to the end of the list) */
-#define m_AVD_EVT_QUEUE_ENQUEUE(cb, evt) \
-{ \
- AVD_EVT_QUEUE_LIST *list = &((cb)->evt_queue); \
- if (!(list->evt_msg_queue)) \
- list->evt_msg_queue = (evt); \
- else \
- list->tail->next = (evt); \
- list->tail = (evt); \
-}
-
-/* macro to dequeue the msg (from the beginning of the list) */
-#define m_AVD_EVT_QUEUE_DEQUEUE(cb, evt) \
-{ \
- AVD_EVT_QUEUE_LIST *list = &((cb)->evt_queue); \
- if (list->evt_msg_queue) { \
- (evt) = list->evt_msg_queue; \
- list->evt_msg_queue = (evt)->next; \
- (evt)->next = 0; \
- if (list->tail == (evt)) list->tail = 0; \
- } else (evt) = 0; \
-}
-
extern AVD_CL_CB *avd_cb;
struct avd_evt_tag;
diff --git a/osaf/services/saf/amf/amfd/main.cc
b/osaf/services/saf/amf/amfd/main.cc
--- a/osaf/services/saf/amf/amfd/main.cc
+++ b/osaf/services/saf/amf/amfd/main.cc
@@ -377,7 +377,7 @@ static void handle_event_in_failover_sta
/* Enqueue this event */
queue_evt = new AVD_EVT_QUEUE();
queue_evt->evt = evt;
- m_AVD_EVT_QUEUE_ENQUEUE(cb, queue_evt);
+ cb->evt_queue.push(queue_evt);
}
std::map<uint32_t, AVD_FAIL_OVER_NODE *>::const_iterator it =
node_list_db->begin();
@@ -389,12 +389,12 @@ static void handle_event_in_failover_sta
/* Dequeue, all the messages from the queue
and process them now */
- m_AVD_EVT_QUEUE_DEQUEUE(cb, queue_evt);
- while (NULL != queue_evt) {
+ while (!cb->evt_queue.empty()) {
+ queue_evt = cb->evt_queue.front();
+ cb->evt_queue.pop();
process_event(cb, queue_evt->evt);
delete queue_evt;
- m_AVD_EVT_QUEUE_DEQUEUE(cb, queue_evt);
}
/* Walk through all the nodes to check if any of the nodes
state is
------------------------------------------------------------------------------
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel