func = bind(&ResourceManager::GetExecutorResourceInfo, this, _1, info);
VMPoolI::Instance()->MapToDo(func);
LOG4CPLUS_DEBUG(logger, "in GetMachineInfo vm num:" << info.vm_list.size());
也就是我MapToDo想把所有的虚拟机信息全部放入info的vm_list中去,在下面的函数中,的确是push进去了,但是回来之后vm_list.size就为0了,这个引用没有起到应用的效果。传入指针好像就好使用了。是不是多个一个MapToDo把引用信息给丢失了?以后还是用指针?
调用下面的函数:
void ResourceManager::GetExecutorResourceInfo(const VMPtr& ptr, MachineInfo& info) {
if(ptr->GetState() == VM_RUN) {
LOG4CPLUS_DEBUG(logger, "in GetExecutorResourceInfo vm:" << ptr->GetId()
<< " state:" << ptr->GetState());
info.vm_list.push_back(ptr->GetUsedResource());
}
LOG4CPLUS_DEBUG(logger, "in GetExecutorResourceInfo vm num:" << info.vm_list.size());
}