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

Method lockState

src/jrd/replication/ChangeLog.cpp:438–472  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

436}
437
438void ChangeLog::lockState()
439{
440 m_localMutex.enter(FB_FUNCTION);
441 m_sharedMemory->mutexLock();
442
443 // Reattach if someone has just deleted the shared file
444
445 while (m_sharedMemory->getHeader()->isDeleted())
446 {
447 // Shared memory must be empty at this point
448 fb_assert(!m_sharedMemory->getHeader()->pidLower);
449 fb_assert(!m_sharedMemory->getHeader()->pidUpper);
450
451 m_sharedMemory->mutexUnlock();
452 m_sharedMemory.reset();
453
454 Thread::yield();
455
456 initSharedFile();
457 m_sharedMemory->mutexLock();
458 }
459
460 try
461 {
462 const auto state = m_sharedMemory->getHeader();
463
464 if (m_segments.isEmpty() || state->generation != m_generation)
465 initSegments();
466 }
467 catch (const Exception&)
468 {
469 unlockState();
470 throw;
471 }
472}
473
474void ChangeLog::unlockState()
475{

Callers 2

LockGuardMethod · 0.80
~LockCheckoutMethod · 0.80

Calls 8

mutexLockMethod · 0.80
isDeletedMethod · 0.80
mutexUnlockMethod · 0.80
yieldClass · 0.50
enterMethod · 0.45
getHeaderMethod · 0.45
resetMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected