使用map的时候无法清空map里面的数据
class Mytl{ //主程序代码}class MytlOSCfg{public: map<CString,Mytl*> threadList; CRITICAL_SECTION mytlThreadListLock;}class MytlDlg{public: MytlOSCfg *osCfg = new MytlOSCfg; afx_msg LRESULT CMytlDlg::StopAll(WPARAM wParam,LPARAM lParam) { EnterCriticalSection(&osCfg->mytlThreadListLock); osCfg->threadList.clear();//在这里用SGList.empty()判断已经是空的了 updataThreadList(); LeaveCriticalSection(&osCfg->mytlThreadListLock); }void CMytlDlg::updataThreadList(){ m_LBThreadsListItems.ResetContent(); if(!osCfg->threadList->empty())//这里向ListBox中添加数据的时候里面又有值了 { for (map<CString,Mytl*>::iterator iter=threadList->begin();iter!=threadList->end();iter++) { m_LBThreadsListItems.AddString(iter->first); } }}};