diff --git a/src/jrd/Database.cpp b/src/jrd/Database.cpp index a162a44c9b..e9a1c8105a 100644 --- a/src/jrd/Database.cpp +++ b/src/jrd/Database.cpp @@ -270,8 +270,8 @@ namespace Jrd if (!counter->lock) { - Lock* const lock = FB_NEW_RPT(*dbb->dbb_permanent, 0) - Lock(tdbb, sizeof(SLONG), LCK_shared_counter, counter, blockingAst); + Lock* const lock = + FB_NEW_RPT(*dbb->dbb_permanent, 0) Lock(tdbb, sizeof(SLONG), LCK_shared_counter); counter->lock = lock; lock->lck_key.lck_long = space; LCK_lock(tdbb, lock, LCK_PW, LCK_WAIT); @@ -283,7 +283,6 @@ namespace Jrd if (counter->curVal > counter->maxVal) { LCK_convert(tdbb, counter->lock, LCK_PW, LCK_WAIT); - counter->curVal = LCK_read_data(tdbb, counter->lock); if (!counter->curVal) @@ -294,31 +293,12 @@ namespace Jrd counter->maxVal = counter->curVal + prefetch - 1; LCK_write_data(tdbb, counter->lock, counter->maxVal + 1); + LCK_convert(tdbb, counter->lock, LCK_SR, LCK_WAIT); } return counter->curVal++; } - int Database::SharedCounter::blockingAst(void* ast_object) - { - ValueCache* const counter = static_cast(ast_object); - fb_assert(counter && counter->lock); - Database* const dbb = counter->lock->lck_dbb; - - try - { - AsyncContextHolder tdbb(dbb, FB_FUNCTION); - - SyncLockGuard guard(&dbb->dbb_sh_counter_sync, SYNC_EXCLUSIVE, "Database::blockingAstSharedCounter"); - - LCK_downgrade(tdbb, counter->lock); - } - catch (const Exception&) - {} // no-op - - return 0; - } - void Database::Linger::handler() { JRD_shutdown_database(dbb, SHUT_DBB_RELEASE_POOLS); diff --git a/src/jrd/Database.h b/src/jrd/Database.h index 5348005acf..9feba428cc 100644 --- a/src/jrd/Database.h +++ b/src/jrd/Database.h @@ -259,8 +259,6 @@ public: void shutdown(thread_db* tdbb); private: - static int blockingAst(void* arg); - ValueCache m_counters[TOTAL_ITEMS]; };