mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-26 02:02:14 +02:00
Add some more ensure_state()
This commit is contained in:
@@ -532,6 +532,7 @@ remove_from_disk_cache(PyObject *self_, const void *key, size_t key_sz) {
|
|||||||
void
|
void
|
||||||
clear_disk_cache(PyObject *self_) {
|
clear_disk_cache(PyObject *self_) {
|
||||||
DiskCache *self = (DiskCache*)self_;
|
DiskCache *self = (DiskCache*)self_;
|
||||||
|
if (!ensure_state(self)) return;
|
||||||
CacheEntry *s, *tmp;
|
CacheEntry *s, *tmp;
|
||||||
mutex(lock);
|
mutex(lock);
|
||||||
HASH_ITER(hh, self->entries, s, tmp) {
|
HASH_ITER(hh, self->entries, s, tmp) {
|
||||||
@@ -607,6 +608,7 @@ end:
|
|||||||
bool
|
bool
|
||||||
disk_cache_wait_for_write(PyObject *self_, monotonic_t timeout) {
|
disk_cache_wait_for_write(PyObject *self_, monotonic_t timeout) {
|
||||||
DiskCache *self = (DiskCache*)self_;
|
DiskCache *self = (DiskCache*)self_;
|
||||||
|
if (!ensure_state(self)) return false;
|
||||||
monotonic_t end_at = monotonic() + timeout;
|
monotonic_t end_at = monotonic() + timeout;
|
||||||
while (!timeout || monotonic() <= end_at) {
|
while (!timeout || monotonic() <= end_at) {
|
||||||
bool pending = false;
|
bool pending = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user