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

Method waitForMutex

src/jrd/MetaName.cpp:411–442  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

409}
410
411Dictionary::HashTable* Dictionary::waitForMutex(Jrd::Dictionary::Word** checkWordPtr)
412{
413 Firebird::MutexLockGuard guard(mutex, FB_FUNCTION);
414
415#if DIC_STATS > 0
416 ++conflicts;
417#endif
418
419 HashTable* t = hashTable.load();
420 if (!checkWordPtr)
421 return t;
422
423 // may be we already have that word in new table
424 FB_SIZE_T len = (*checkWordPtr)->length();
425 const char* s = (*checkWordPtr)->c_str();
426 Word* word = t->getEntryByHash(s, len)->load();
427 while (word)
428 {
429 if (word->length() == len && memcmp(word->c_str(), s, len) == 0)
430 {
431 // successfully found same word in new table - use it
432 *checkWordPtr = word;
433 // no need performing any more ops with hash table
434 return nullptr;
435 }
436 word = word->next;
437 }
438
439 // checkWord was added to old hash table right now & is missing in new one
440 // we should repeat adding it to the new hash table
441 return t;
442}
443
444Dictionary::Segment::Segment()
445{

Callers

nothing calls this directly

Calls 4

getEntryByHashMethod · 0.80
loadMethod · 0.45
lengthMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected