| 409 | } |
| 410 | |
| 411 | Dictionary::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 | |
| 444 | Dictionary::Segment::Segment() |
| 445 | { |
nothing calls this directly
no test coverage detected