Rehash in ms+"delta" milliseconds. The value of "delta" is larger * than 0, and is smaller than 1 in most cases. The exact upper bound * depends on the running time of dictRehash(d,100).*/
| 576 | * than 0, and is smaller than 1 in most cases. The exact upper bound |
| 577 | * depends on the running time of dictRehash(d,100).*/ |
| 578 | int dictRehashMilliseconds(dict *d, int ms) { |
| 579 | if (d->pauserehash > 0) return 0; |
| 580 | |
| 581 | long long start = timeInMilliseconds(); |
| 582 | int rehashes = 0; |
| 583 | |
| 584 | while(dictRehash(d,1000)) { |
| 585 | rehashes += 1000; |
| 586 | if (timeInMilliseconds()-start > ms) break; |
| 587 | } |
| 588 | return rehashes; |
| 589 | } |
| 590 | |
| 591 | /* This function performs just a step of rehashing, and only if hashing has |
| 592 | * not been paused for our hash table. When we have iterators in the |
no test coverage detected