MCPcopy Create free account
hub / github.com/URLab-Sim/UnrealRoboticsLab / Close

Method Close

Source/URLab/Private/Transport/ShmRegion.cpp:173–205  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

171}
172
173void FMjShmRegion::Close(bool bDeleteFile)
174{
175 if (MappedAddr == nullptr)
176 return;
177
178#if PLATFORM_WINDOWS
179 ::UnmapViewOfFile(MappedAddr);
180 if (PlatformMappingHandle)
181 ::CloseHandle(static_cast<HANDLE>(PlatformMappingHandle));
182 if (PlatformFileHandle)
183 ::CloseHandle(static_cast<HANDLE>(PlatformFileHandle));
184#else
185 ::munmap(MappedAddr, static_cast<size_t>(MappedSize));
186 if (PlatformFileHandle)
187 {
188 const int fd = static_cast<int>(reinterpret_cast<intptr_t>(PlatformFileHandle));
189 ::close(fd);
190 }
191#endif
192
193 if (bDeleteFile && !FilePath.IsEmpty())
194 {
195 IFileManager::Get().Delete(*FilePath, /*RequireExists=*/false, /*EvenReadOnly=*/false, /*Quiet=*/true);
196 }
197
198 MappedAddr = nullptr;
199 PlatformFileHandle = nullptr;
200 PlatformMappingHandle = nullptr;
201 MappedSize = 0;
202 BufferStride = 0;
203 NumBuffers = 0;
204 FilePath.Reset();
205}

Callers 3

TransportShutdownMethod · 0.45
TransportInitMethod · 0.45
TransportShutdownMethod · 0.45

Calls 2

IsEmptyMethod · 0.80
ResetMethod · 0.45

Tested by

no test coverage detected