summaryrefslogtreecommitdiff
path: root/Makerules
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2013-04-22 15:14:38 +0100
committerRobin Watts <robin.watts@artifex.com>2013-04-22 15:22:29 +0100
commit2ea11eace69fe5a2d88f374a253a3deb05804f2d (patch)
treee6e1cfff1abdf62f3da53aa053897f7a26c535d3 /Makerules
parent784fc400b3415f5120e3eef59a43e519c6a06fe0 (diff)
downloadmupdf-2ea11eace69fe5a2d88f374a253a3deb05804f2d.tar.xz
Fix various multi-threading problems with the store.
When resizing the hash table, we have a special case to cope with someone else resizing the table before we get a chance to. In this rare situation we were unlocking (regardless of whether we should have been), and failing to relock. Fixed here. When storing an item, I recently changed the code to put the new item into the hash before ensuring that we had enough space. This change was motivated by us wanting not to evict to make room only to find that we didn't need the room as there was a duplicate entry anyway. In so doing, this opened up a potential race condition where another thread could 'find' the item from the hash before it had been filled out. To solve this, we move the "filling out" of the item entries earlier in the function. Another problem is found due to the same block of code; as soon as a new item is put into the hash, it can be found elsewhere. Any attempt to manipulate it's linked list will fail. We therefore set all new items with their prev/next pointers pointing to themselves, enabling us to spot this special case and avoid corrupting the linked list.
Diffstat (limited to 'Makerules')
0 files changed, 0 insertions, 0 deletions