Build a Lean `Array G` from a slice of field elements.
(values: &[G])
| 660 | // Admit-when-alone: a shard whose estimate alone exceeds the |
| 661 | // budget must still run (by itself) rather than deadlock. |
| 662 | while *used > 0 && *used + bytes > self.budget { |
| 663 | used = self.cv.wait(used).unwrap(); |
| 664 | } |
| 665 | *used += bytes; |
| 666 | } |
| 667 | |
| 668 | fn release(&self, bytes: usize) { |
| 669 | *self.reserved.lock().unwrap() -= bytes; |
| 670 | self.cv.notify_all(); |
| 671 | } |
no test coverage detected