Returning of const pointer to data_value in class QueueElement and returning of const pointer to element inserted in AddElement() in class ConcQueue added
diff --git a/ConcQueue.h b/ConcQueue.h
index eeef3c3..0ab762f 100644
--- a/ConcQueue.h
+++ b/ConcQueue.h
@@ -39,6 +39,11 @@
{
return next;
}
+
+ const data_val_type* GetPointerToData()
+ {
+ return (&data_value);
+ }
};
template<class data_val_type> class ConcQueue
@@ -73,7 +78,7 @@
}
}
- void AddElement(data_val_type val)
+ QueueElement<data_val_type>* AddElement(data_val_type val)
{
QueueElement<data_val_type> *temp = NULL;
lock_queue current_lock;
@@ -96,12 +101,16 @@
head = new QueueElement<data_val_type>(val);
tail = head;
CAS(&(insertion_lock.lock_value), 1 ,0);
+
+ return (head);
}
else
{
tail->SetPointer(temp);
tail = temp;
CAS(&(insertion_lock.lock_value), 1, 0);
+
+ return (temp);
}
}