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

Function CCH_shutdown

src/jrd/cch.cpp:2210–2291  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2208
2209
2210void CCH_shutdown(thread_db* tdbb)
2211{
2212/**************************************
2213 *
2214 * C C H _ s h u t d o w n
2215 *
2216 **************************************
2217 *
2218 * Functional description
2219 * Shutdown database physical page locks.
2220 *
2221 **************************************/
2222 Database* const dbb = tdbb->getDatabase();
2223 BufferControl* const bcb = dbb->dbb_bcb;
2224
2225 if (!bcb)
2226 return;
2227
2228#ifdef CACHE_READER
2229 // Shutdown the dedicated cache reader for this database
2230
2231 if (bcb->bcb_flags & BCB_cache_reader)
2232 {
2233 bcb->bcb_flags &= ~BCB_cache_reader;
2234 dbb->dbb_reader_sem.release();
2235 dbb->dbb_reader_fini.enter();
2236 }
2237#endif
2238
2239 // Wait for cache writer startup to complete
2240
2241 while (bcb->bcb_flags & BCB_writer_start)
2242 Thread::yield();
2243
2244 // Shutdown the dedicated cache writer for this database
2245
2246 if (bcb->bcb_flags & BCB_cache_writer)
2247 {
2248 bcb->bcb_flags &= ~BCB_cache_writer;
2249 bcb->bcb_writer_sem.release(); // Wake up running thread
2250 bcb->bcb_writer_fini.waitForCompletion();
2251 }
2252
2253 SyncLockGuard bcbSync(&bcb->bcb_syncObject, SYNC_EXCLUSIVE, FB_FUNCTION);
2254
2255 // Flush and release page buffers
2256
2257 if (bcb->bcb_count)
2258 {
2259 try
2260 {
2261 if (dbb->dbb_flags & DBB_bugcheck)
2262 LongJump::raise();
2263
2264 CCH_flush(tdbb, FLUSH_FINI, 0);
2265 }
2266 catch (const Exception&)
2267 {

Callers 3

JRD_shutdown_databaseFunction · 0.85
ERR_bugcheckFunction · 0.85
ERR_bugcheck_msgFunction · 0.85

Calls 11

raiseFunction · 0.85
CCH_flushFunction · 0.85
PAGE_LOCK_RELEASEFunction · 0.85
SDW_closeFunction · 0.85
getDatabaseMethod · 0.80
closeAllMethod · 0.80
yieldClass · 0.50
releaseMethod · 0.45
enterMethod · 0.45
waitForCompletionMethod · 0.45

Tested by

no test coverage detected