S
Sachin Jagtap
Hi,
I am getting exception while poping item from queue, I am writing
messages coming from client in a queue in one thread and then in other
thread i am reading from queue and writing in file.
I have not implemented any syncronization between reading and
wrinting, just i checking size of queue, if it is not empty i am
reading from queue and wrting to file.
somethign like
class CMessage
{
public:
string strmessage;
};
thread 1
{
CMessage objMessage;
queue.push(objMessage);
}
thread2
{
if(size of queue is not empty)
{
CMessage objmessage = queue.front(); //SOMETIMES I AM GETTING
EXCEPTION HERE.
queue.pop();
WriteInFile();
}
}
I am getting exception while poping item from queue, I am writing
messages coming from client in a queue in one thread and then in other
thread i am reading from queue and writing in file.
I have not implemented any syncronization between reading and
wrinting, just i checking size of queue, if it is not empty i am
reading from queue and wrting to file.
somethign like
class CMessage
{
public:
string strmessage;
};
thread 1
{
CMessage objMessage;
queue.push(objMessage);
}
thread2
{
if(size of queue is not empty)
{
CMessage objmessage = queue.front(); //SOMETIMES I AM GETTING
EXCEPTION HERE.
queue.pop();
WriteInFile();
}
}