Hi all,
I have a query regarding the exchanging of a
boost::shared_ptr beween different threads. In my program i've two
threads both of which having their own internal queues for storing the
shared_ptr. one thread is meant to pass the shared_ptr to another after
its processing.
So when a message arrives i convert it into a class of
my own called 'Msg' and i put the 'Msg' object pointer into a
shared_ptr and put into the other thread's message queue. in that
second thread after starting the processing suddenly the program stops
responding. when i examined the log files and tried tracing, i noticed
that the 'shared_ptr' is getting destroyed just after it has been
released by the first thread after putting it into the second thread's
message queue. I am passing the shared_ptr as reference.
anybody knows what cud be the reason? or is it
that shared_ptr is not meant to work that way?
Sreehari