libgit2/libgit2 — pull request #884 by carlosmn (2012-08-18 20:49:10+00:00)
Title: Make the memory-window conrol structures global

Up to now, the idea was that the user would do all the operations for
one repository in the same thread. Thus we could have the
memory-mapped window information thread-local and avoid any locking.

This is not practical in a few environments, such as Apple's GCD which
allocates threads arbitrarily or the .NET CLR, where the OS-level
thread can change at any moment.

make the control structur global and protect it with a mutex so we
don't depend on the thread currently executing the code.

---

So this is one way. We could also go the other way and make it repo-specific, as it's unlikely that two repos are going to be sharing the same windows and would be lockless like now.