OpenMP 内存操作
本帖最后由 cau228charm 于 2011-10-31 15:16:39 编辑 OpenMP中关于共享和私有的定义适用于指针变量吗? 比如下面一段代码
unsigned char *pBlockImg = NULL;
int i,j;
unsigned short StartX = 0;
unsigned short StartY = 0;
#pragma omp parallel for private(StartX,StartY,j)
for (i = 0; i < nYBlocks; ++i)
{
StartY = i * nYBlockSize;
for (j = 0; j < nXBlocks; ++j)
{
StartX = j * nXBlockSize;
int nXValid = 0; int nYValid = 0; nXValid = nXBlockSize<(nSrcImgWidth - StartX)?nXBlockSize:(nSrcImgWidth-StartX);
nYValid = nYBlockSize<(nSrcImgHeight - StartY)?nYBlockSize:(nSrcImgHeight - StartY);
pBlockImg = new unsigned char[nXValid*nYValid];
// 操作
if (pBlockImg)
{
delete []pBlockImg;
pBlockImg = NULL;
}
}
}