X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Futil%2Fdisk_cache.c;h=a92d621927a857f262e15ea100db65a513b755f2;hb=7fbadfc385c359fd291d58a75fbe6ce3fdc91747;hp=e5b21b9a79f5620c4f040561908a2a299a7c1df6;hpb=a8d941091f72923561a6c58b46ccb264b6a0e205;p=mesa.git diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c index e5b21b9a79f..a92d621927a 100644 --- a/src/util/disk_cache.c +++ b/src/util/disk_cache.c @@ -51,8 +51,7 @@ #include "util/u_queue.h" #include "util/mesa-sha1.h" #include "util/ralloc.h" -#include "main/compiler.h" -#include "main/errors.h" +#include "util/compiler.h" #include "disk_cache.h" @@ -455,6 +454,12 @@ disk_cache_destroy(struct disk_cache *cache) ralloc_free(cache); } +void +disk_cache_wait_for_idle(struct disk_cache *cache) +{ + util_queue_finish(&cache->cache_queue); +} + /* Return a filename within the cache's directory corresponding to 'key'. The * returned filename is ralloced with 'cache' as the parent context. * @@ -758,7 +763,11 @@ deflate_and_write_to_disk(const void *in_data, size_t in_data_size, int dest, free(out); return 0; } - write_all(dest, out, ret); + ssize_t written = write_all(dest, out, ret); + if (written == -1) { + free(out); + return 0; + } free(out); return ret; #else