I am using lot of std::queue<uint32_t> Queue
on my c++ runtime application.
I need to understand, what will be the maximum number of values I can push into the queue and what will happen if I pop_front() with any push_back().
Sometimes my code breaks inside a thread when trying to pop a value.
PostEvent(uint32_t EventUid)
{
/* Create Event Thread only when
first event received (E_RESTART.COLD) */
if (!isThreadCreated) {
c_thread::start("event");
isThreadCreated = true;
}
Queue.push_back(EventUid);
}
event_thread::run():
while (isThreadAlive())
{
while (Queue.size())
{
if (!Queue.empty())
{
uint32_t EventUid;
EventUid = Queue[0];
Queue.pop_front();
}
}
}
Also I need to know, can I use data structure like
struct Counter_Elements
{
uint32_t eventId;
std::string applicationName;
std::string functionName;
std::string dataName;
std::string dataValue;
uint64_t count;
char tag;
};
and create a queue like std::queue<Counter_Elements> CountQueue
. If so what will be the max number of counter elements that I can push.