Hi, I have a doubt on using bind library. I pass the output of Bind to Asio library, and at certain point of time another thread will ask Windows I/O service to execute the function append():

m_ioService.post(m_strand.wrap(
                            boost::bind(&LogWriter::append, (*logWritersItr), _logMessage, _logLevelString)
                         ));

The second param of Bind, (*logWritersItr), is a shared_ptr of LogWriter's subclass. The signature of LogWriter::append() is as following:

virtual void append(const std::string& _logMessage, const std::string& _logLevelString) = 0;

Base on document at http://www.boost.org/doc/libs/1_44_0/libs/bind/bind.html, the way I use bind will duplicate a copy of that shared_ptr. Any idea when will the duplicated shared_ptr become invalid so that the reference count decreases by one?


Thanks,
Shiou Ming