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

Method Create

util/system/shmat.cpp:130–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

128}
129
130bool TSharedMemory::Create(int size) {
131 // Y_ASSERT(Data == 0);
132 Size = size;
133
134 CreateGuid(&Id);
135
136 char name[100];
137 FormatName(name, Id);
138 Handle = CreateFileMappingA(INVALID_OS_HANDLE, nullptr, PAGE_READWRITE, 0, size, name);
139
140 if (Handle == 0) {
141 // Y_ASSERT(0);
142 return false;
143 }
144
145 Data = MapViewOfFile(Handle, FILE_MAP_ALL_ACCESS, 0, 0, size);
146
147 if (Data == 0) {
148 // Y_ASSERT(0);
149 CloseHandle(Handle);
150 Handle = INVALID_OS_HANDLE;
151
152 return false;
153 }
154
155 return true;
156}
157
158TSharedMemory::~TSharedMemory() {
159 if (Data) {

Callers 2

Y_UNIT_TESTFunction · 0.45
Y_UNIT_TESTFunction · 0.45

Calls 6

CreateGuidFunction · 0.85
FormatNameFunction · 0.85
shmgetFunction · 0.85
shmatFunction · 0.85
shmctlFunction · 0.85
GetKeyFunction · 0.70

Tested by

no test coverage detected