本文整理汇总了C++中SharedMemNodeData::setWarm方法的典型用法代码示例。如果您正苦于以下问题:C++ SharedMemNodeData::setWarm方法的具体用法?C++ SharedMemNodeData::setWarm怎么用?C++ SharedMemNodeData::setWarm使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SharedMemNodeData
的用法示例。
在下文中一共展示了SharedMemNodeData::setWarm方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setWarm
void SharedDataManager::setWarm(TreeDescriptor treeId, int nid, bool warm)
{
lock.lock();
SharedMemNodeData *nodeData = getNodeData(treeId, nid, true);
if(nodeData)
nodeData->setWarm(warm);
lock.unlock();
}
示例2: void
void *SharedDataManager::setCallback(TreeDescriptor treeId, int nid, void *argument, void (*callback)(int, void *))
{
char *retPtr = NULL;
int status = 0;
lock.lock();
SharedMemNode *retNode = sharedTree.find(treeId, nid);
if(!retNode)
//No data has been written in the cache yet, or the not is not cacheable,
//then create a nid node without data
{
SharedMemNodeData nodeData;
nodeData.setNid(treeId, nid);
sharedTree.insert(&nodeData, &lock);
retNode = sharedTree.find(treeId, nid);
}
if(retNode)
{
//Create a new Callback manager and concatenate it to the linked list of Callback managers
//associated with this nid node
CallbackManager *callbackManager = (CallbackManager *)freeSpaceManager.allocateShared(sizeof(CallbackManager), &lock);
CallbackManager *prevCallbackManager = retNode->getData()->getCallbackManager();
if(prevCallbackManager)
prevCallbackManager->setPrev((char *)callbackManager);
callbackManager->setNext((char *)retNode->getData()->getCallbackManager());
callbackManager->setPrev(NULL);
retNode->getData()->setCallbackManager(callbackManager);
callbackManager->initialize(nid, argument, callback);
SharedMemNodeData *nodeData = retNode->getData();
nodeData->setWarm(true);
lock.unlock();
return callbackManager;
}
else
{
lock.unlock();
return NULL;
}
}