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

Function RLCK_transaction_relation_lock

src/jrd/rlck.cpp:136–176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134
135
136Lock* RLCK_transaction_relation_lock(thread_db* tdbb, jrd_tra* transaction, jrd_rel* relation)
137{
138/**************************************
139 *
140 * R L C K _ t r a n s a c t i o n _ r e l a t i o n _ l o c k
141 *
142 **************************************
143 *
144 * Functional description
145 * Take out a relation lock within the context of
146 * a transaction.
147 *
148 **************************************/
149 SET_TDBB(tdbb);
150
151 const ULONG relId = relation->rel_id;
152
153 Lock* lock;
154 vec<Lock*>* vector = transaction->tra_relation_locks;
155 if (vector && (relId < vector->count()) && (lock = (*vector)[relId]))
156 {
157 return lock;
158 }
159
160 vector = transaction->tra_relation_locks =
161 vec<Lock*>::newVector(*transaction->tra_pool, transaction->tra_relation_locks, relId + 1);
162 lock = jrd_rel::createLock(tdbb, transaction->tra_pool, relation, LCK_relation, true);
163
164 // enter all relation locks into the intra-process lock manager and treat
165 // them as compatible within the attachment according to IPLM rules
166 lock->lck_compatible = tdbb->getAttachment();
167 // for relations locked within a transaction, add a second level of
168 // compatibility within the intra-process lock manager which specifies
169 // that relation locks are incompatible with locks taken out by other
170 // transactions, if a transaction is specified
171 lock->lck_compatible2 = transaction;
172
173 (*vector)[relId] = lock;
174
175 return lock;
176}

Callers 2

RLCK_reserve_relationFunction · 0.85
expand_view_lockFunction · 0.85

Calls 3

SET_TDBBFunction · 0.85
countMethod · 0.45
getAttachmentMethod · 0.45

Tested by

no test coverage detected