MCPcopy Create free account
hub / github.com/catboost/catboost / Close

Method Close

library/cpp/netliba/v12/posix_shared_memory.h:68–87  ·  view source on GitHub ↗

after unlinking Open will return false, and Create may map new region with same name.

Source from the content-addressed store, hash-verified

66
67 // after unlinking Open will return false, and Create may map new region with same name.
68 void Close(const EUnlinkPolicy up = UP_CREATOR_UNLINKS) // default argument for compatibility with TSharedMemory
69 {
70 Y_ASSERT((Ptr == nullptr) == (Size == 0));
71 Y_ASSERT((Fd == INVALID_HANDLE_VALUE) == Guid.IsEmpty());
72
73 if (Ptr != INVALID_POINTER_VALUE) {
74 munmap(Ptr, Size);
75 }
76 Ptr = INVALID_POINTER_VALUE;
77 Size = 0;
78
79 if (Fd != INVALID_HANDLE_VALUE) {
80 close(Fd);
81 Unlink(up);
82 }
83 Fd = INVALID_HANDLE_VALUE;
84 Guid = TGUID();
85
86 IsCreator = false;
87 }
88
89 // Nobody can Open this shared memory again!
90 // But this shared memory will be removed only when all attached processes exit (or terminate).

Callers

nothing calls this directly

Calls 3

closeFunction · 0.50
TGUIDClass · 0.50
IsEmptyMethod · 0.45

Tested by

no test coverage detected