MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / acquire

Method acquire

src/jrd/Monitoring.cpp:208–243  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

206
207
208void MonitoringData::acquire()
209{
210 m_localMutex.enter(FB_FUNCTION);
211 m_sharedMemory->mutexLock();
212
213 // Reattach if someone has just deleted the shared file
214
215 while (m_sharedMemory->getHeader()->isDeleted())
216 {
217 // Shared memory must be empty at this point
218 fb_assert(m_sharedMemory->getHeader()->used == HEADER_SIZE);
219
220 m_sharedMemory->mutexUnlock();
221 m_sharedMemory.reset();
222
223 Thread::yield();
224
225 initSharedFile();
226 m_sharedMemory->mutexLock();
227 }
228
229 if (m_sharedMemory->getHeader()->allocated > m_sharedMemory->sh_mem_length_mapped)
230 {
231#ifdef HAVE_OBJECT_MAP
232 FbLocalStatus statusVector;
233 if (!m_sharedMemory->remapFile(&statusVector, m_sharedMemory->getHeader()->allocated, false))
234 {
235 release();
236 status_exception::raise(&statusVector);
237 }
238#else
239 release();
240 status_exception::raise(Arg::Gds(isc_montabexh));
241#endif
242 }
243}
244
245
246void MonitoringData::release()

Callers

nothing calls this directly

Calls 11

raiseFunction · 0.85
GdsClass · 0.85
mutexLockMethod · 0.80
isDeletedMethod · 0.80
mutexUnlockMethod · 0.80
remapFileMethod · 0.80
yieldClass · 0.50
releaseFunction · 0.50
enterMethod · 0.45
getHeaderMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected