summaryrefslogtreecommitdiff
path: root/fitz/fitz-internal.h
diff options
context:
space:
mode:
authorRobin Watts <robin@peeves.(none)>2013-04-25 06:09:47 -0700
committerRobin Watts <robin.watts@artifex.com>2013-04-26 14:42:53 +0100
commitd1a3e6b7b72f54f291f11a50cd5c043984126885 (patch)
treee04c82058e46afcee8b2f010f759e836e06eeae2 /fitz/fitz-internal.h
parentbfd1effe99d5038577cdc0be889e5424613f3c08 (diff)
downloadmupdf-d1a3e6b7b72f54f291f11a50cd5c043984126885.tar.xz
Multi-threaded store SEGV fixes and debug improvements.
Fix race condition in the store. When storing an item, we immediately put it into the hash (thus getting our existence check). We then check and try to free enough space for it in the budget. If we cannot free enough, we remove the item from the hash. The race condition comes if someone else finds it in the hash in the meantime. To fix this, we update all 'finds' of things in the hash to move it to the head of the LRU chain (regardless of whether it was in the chain before or not). We only remove it from the hash in the 'failed-to-fit-in-the-budget' case if it's not in the chain already. Also, we fix a bug in the "failed to fit" removal case where we were failing to realise that the the pos pointer was not valid any more. In the course of tracking this bug down various debug functions were improved. These are committed here too.
Diffstat (limited to 'fitz/fitz-internal.h')
-rw-r--r--fitz/fitz-internal.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/fitz/fitz-internal.h b/fitz/fitz-internal.h
index 7193301a..bf7d2873 100644
--- a/fitz/fitz-internal.h
+++ b/fitz/fitz-internal.h
@@ -271,6 +271,7 @@ void *fz_hash_get_val(fz_context *ctx, fz_hash_table *table, int idx);
#ifndef NDEBUG
void fz_print_hash(fz_context *ctx, FILE *out, fz_hash_table *table);
+void fz_print_hash_details(fz_context *ctx, FILE *out, fz_hash_table *table, void (*details)(FILE *, void *));
#endif
/*
@@ -587,6 +588,7 @@ int fz_store_scavenge(fz_context *ctx, unsigned int size, int *phase);
*/
#ifndef NDEBUG
void fz_print_store(fz_context *ctx, FILE *out);
+void fz_print_store_locked(fz_context *ctx, FILE *out);
#endif
struct fz_buffer_s