| 371 | } |
| 372 | |
| 373 | int64_t DecreaseBytesRemaining( |
| 374 | int64_t max_decrease, bool require_full_decrease, AtomicInt64* bytes_remaining) { |
| 375 | while (true) { |
| 376 | int64_t old_value = bytes_remaining->Load(); |
| 377 | if (require_full_decrease && old_value < max_decrease) return 0; |
| 378 | int64_t decrease = min(old_value, max_decrease); |
| 379 | int64_t new_value = old_value - decrease; |
| 380 | if (bytes_remaining->CompareAndSwap(old_value, new_value)) { |
| 381 | return decrease; |
| 382 | } |
| 383 | } |
| 384 | } |
| 385 | |
| 386 | int64_t BufferPool::BufferAllocator::ScavengeBuffers( |
| 387 | bool slow_but_sure, int current_core, int64_t target_bytes) { |
no test coverage detected