| 193 | |
| 194 | |
| 195 | GarbageCollector::RelationData* GarbageCollector::getRelData(Sync &sync, const USHORT relID, |
| 196 | bool allowCreate) |
| 197 | { |
| 198 | FB_SIZE_T pos; |
| 199 | |
| 200 | sync.lock(SYNC_SHARED); |
| 201 | if (!m_relations.find(relID, pos)) |
| 202 | { |
| 203 | if (!allowCreate) |
| 204 | return NULL; |
| 205 | |
| 206 | sync.unlock(); |
| 207 | sync.lock(SYNC_EXCLUSIVE); |
| 208 | if (!m_relations.find(relID, pos)) |
| 209 | { |
| 210 | m_relations.insert(pos, FB_NEW_POOL(m_pool) RelationData(m_pool, relID)); |
| 211 | } |
| 212 | sync.downgrade(SYNC_SHARED); |
| 213 | } |
| 214 | |
| 215 | return m_relations[pos]; |
| 216 | } |
| 217 | |
| 218 | |
| 219 | } // namespace Jrd |