Hi Alen, Good catch. I actually found this bug when I did the Solaris port. My implementation was the same as the one that you suggest.
- Doug On Thu, Dec 3, 2009 at 2:02 AM, Alen Wu <[email protected]> wrote: > the flowing source code would cause assertion failed: > if (iter != m_impl->conn_map.end()) { > ScopedLock conn_lock((*iter).second->mutex); > if ((*iter).second->connected) > do_close = true; > else > (*iter).second->connected = true; // prevent further attempts > m_impl->conn_map.erase(iter); > } > > because the code line "m_impl->conn_map.erase(iter);" would destroy > the "(*iter).second->mutex", but the mutex would be in the "lock" > state. So in the > boost::mutex destruction, the assertion would failed. it may use > another brace > to surround the "ScopedLock conn_lock((*iter).second->mutex);" to > solve the problem, just like: > > if (iter != m_impl->conn_map.end()) { > { // added to solve the problem > ScopedLock conn_lock((*iter).second->mutex); > if ((*iter).second->connected) > do_close = true; > else > (*iter).second->connected = true; // prevent further attempts > } // added to solve the problem > m_impl->conn_map.erase(iter); > } > > -- > > You received this message because you are subscribed to the Google Groups > "Hypertable Development" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<hypertable-dev%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/hypertable-dev?hl=en. > > > -- You received this message because you are subscribed to the Google Groups "Hypertable Development" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/hypertable-dev?hl=en.
