libgit2/libgit2 — pull request #1465 by arrbee (2013-04-12 20:36:22+00:00)
Title: new-cache threading tests

This started out with me attempting to write some threaded tests for the new-cache and ended up with adding a mutex to serialize mapping and unmapping of pack file data so that lookups work even in a multithreaded environment.

Without the mutex, the `object::cache` test I wrote would frequently (but not always) crash (when compiled with -DTHREADSAFE=ON of course). With the mutex, the problem seems to be resolved and I can safely lookup objects from the same repository in a multi-threaded environment.

Please see what you think.

By the way, the new-cache branch currently leaks all of the items in the cache from what I see in valgrind. I was valgrinding these threading tests to make sure I hadn't fucked up too badly and they seem okay (amidst the general noise on this new-cache branch right now).