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

Method find_lock

src/lock/lock.cpp:2066–2107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2064#endif
2065
2066lbl* LockManager::find_lock(USHORT series,
2067 const UCHAR* value,
2068 USHORT length,
2069 USHORT* slot)
2070{
2071/**************************************
2072 *
2073 * f i n d _ l o c k
2074 *
2075 **************************************
2076 *
2077 * Functional description
2078 * Find a lock block given a resource
2079 * name. If it doesn't exist, the hash
2080 * slot will be useful for enqueing a
2081 * lock.
2082 *
2083 **************************************/
2084
2085 // See if the lock already exists
2086
2087 const USHORT hash_slot = *slot =
2088 (USHORT) InternalHash::hash(length, value, m_sharedMemory->getHeader()->lhb_hash_slots);
2089
2090 ASSERT_ACQUIRED;
2091 srq* const hash_header = &m_sharedMemory->getHeader()->lhb_hash[hash_slot];
2092
2093 for (srq* lock_srq = (SRQ) SRQ_ABS_PTR(hash_header->srq_forward);
2094 lock_srq != hash_header; lock_srq = (SRQ) SRQ_ABS_PTR(lock_srq->srq_forward))
2095 {
2096 lbl* lock = (lbl*) ((UCHAR*) lock_srq - offsetof(lbl, lbl_lhb_hash));
2097 if (lock->lbl_series != series || lock->lbl_length != length)
2098 {
2099 continue;
2100 }
2101
2102 if (!length || !memcmp(value, lock->lbl_key, length))
2103 return lock;
2104 }
2105
2106 return NULL;
2107}
2108
2109
2110lrq* LockManager::get_request(SRQ_PTR offset)

Callers

nothing calls this directly

Calls 2

hashFunction · 0.50
getHeaderMethod · 0.45

Tested by

no test coverage detected