deadlocking, not sure why...
here's the main code that populates a vector
Code:
// handle incoming data
boost::lock_guard<boost::recursive_mutex> lock(__mutex);
m_data.push_back(data); // vector of strings
m_lb.AddString(item); // MFC CListBox
m_lb.SetCurSel(m_data.size() - 1);
OnListBoxChanged(); // event handler for CListBox
the event handler
Code:
void OnListBoxChanged()
{
boost::lock_guard<boost::recursive_mutex> lock(__mutex);
int index = m_lb.GetCurSel();
m_txt.SetWindowText(m_data[index]); // a textbox
}
ok, so data is coming in really fast, and the program auto refreshes the dialog so that the textbox is updated. if at that time i click on another item in the listbox, it triggers the OnListBoxChanged event, and then it deadlocks. also, it doesn't happen easily...what i mean is i have to click the listbox as fast as humanly possible for it to deadlock.
the thing i don't understand is....there's only 1 mutex!!! why's the program still deadlocking?