getreturnthread.cpp

来自「MPICH是MPI的重要研究,提供了一系列的接口函数,为并行计算的实现提供了编程」· C++ 代码 · 共 64 行

CPP
64
字号
#include "GetReturnThread.h"#include "global.h"// Function name	: GetReturnThread// Description	    : // Return type		: void // Argument         : GetReturnThreadArg *pArgvoid GetReturnThread(GetReturnThreadArg *pArg){	int n = 0;	void *pDbsValue;	char *pBuf;	MPD_CMD_HANDLE hCommand;	g_Database.Get(pArg->pszDbsID, pArg->pszDbsKey, pDbsValue, &n);	if (n>0)	{		pDbsValue = new char[n];		if (g_Database.Get(pArg->pszDbsID, pArg->pszDbsKey, pDbsValue, &n) == MPI_DBS_SUCCESS)		{			pArg->command.hCmd.nBufferLength = 2 * sizeof(unsigned long) + 2 * sizeof(int);			pBuf = &pArg->command.pCommandBuffer[2 * sizeof(unsigned long) + sizeof(int)];			*((int *)(pBuf)) = n;			pBuf += sizeof(int);			memcpy(pBuf, pDbsValue, n);			delete pArg->pszDbsKey;		}		delete pDbsValue;	}	pArg->command.hCmd.nBufferLength += n;	pArg->command.nCommand = MPD_CMD_FORWARD;		hCommand = InsertCommand(pArg->command);	//WaitForCommand(hCommand);	delete pArg;}// Function name	: GetThread// Description	    : // Return type		: void // Argument         : GetReturnThreadArg *pArgvoid GetThread(GetReturnThreadArg *pArg){	int n = 0;	void *pDbsValue = NULL;	g_Database.Get(pArg->pszDbsID, pArg->pszDbsKey, pDbsValue, &n);	if (n>0)	{		pDbsValue = new char[n];		if (g_Database.Get(pArg->pszDbsID, pArg->pszDbsKey, pDbsValue, &n) == MPI_DBS_SUCCESS)		{			pArg->pCommand->hCmd.nBufferLength = n;			memcpy(pArg->pCommand->pCommandBuffer, pDbsValue, n);			delete pArg->pszDbsKey;		}		delete pDbsValue;	}	MarkCommandCompleted(pArg->pCommand);	delete pArg;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?