admin 管理员组

文章数量: 887021


2023年12月17日发(作者:git clones是什么意思)

{ if (m_Blint) { return ; } if (OrEmpty(sharedMemoryName)) { return rror; } if (memorySize <= 0 || memorySize > Memory_MaxSize) { memorySize = Memory_MaxSize; } m_Memsize = memorySize; //1.

创建内存共享体,存进字段 m_hSharedMemoryFile = CreateFileMapping(Invalib_Handle_value, , (uint)Page_Read_Write, 0, (uint)memorySize, sharedMemoryName); //2.

判断创建内存共享体是否成功 if (m_hSharedMemoryFile == ) { m_Blint = false; return ; } else { if (GetLatError() == Error_Alerady_Exists) //判断内存映射是否已经创建 { m_Blint = true; } } //3.

创建内存映射 m_pwData = MapViewOfFile(m_hSharedMemoryFile, File_Map_Write, 0, 0, (uint)memorySize); //4.

判断内存映射是否成功 if (m_pwData == ) { m_Blint = false; CloseHandle(m_hSharedMemoryFile); return ; } else { m_Blint = true; return ; } } catch (Exception ex) { throw ex; } finally { eMutex(); } } public void Close() { e(); if (m_Blint) { UnmapViewOfFile(m_pwData); CloseHandle(m_hSharedMemoryFile); } eMutex(); ();


本文标签: 内存 创建 是否 共享 判断