【发布时间】:2015-11-05 10:08:57
【问题描述】:
我需要的是 std::map<std::string, CCriticalSection> 之类的东西,但 CCriticalSection 是不可复制的。而不是CCriticalSection,我想我可以使用CRICITAL_SECTION,但它也是not possible to copy or move objects of this type。因为它是一个非常古老的项目,我被限制使用 MFC 和 VC6。我想以下列方式访问同步对象(以下代码不起作用,只是我想如何使用字典的一个想法):
// global variable
std::map<std::string, CCriticalSection> csec;
unsigned int somefunc(std::string ip)
{
CSingleLock lock(&csec[ip], TRUE);
// do something
}
所以我的问题是,如何使用 MFC 和 VC6 制作同步对象字典?
感谢您的回答!
【问题讨论】:
标签: c++ mfc visual-c++-6