libgit2/libgit2 — pull request #1471 by arrbee (2013-04-16 22:10:57+00:00)
Title: New cache threading fixes

This contains several fixes related to threading:

* add `git__compare_and_swap` function for atomic ptr CAS operation and move `GIT_MEMORY_BARRIER` to thread-utils.h
* use CAS in all `git_repository_xyz__weakptr()` functions to avoid thread repo initialization issues
* consolidate `git_pack_file` initialization into single function so mutex is always initialized (previously indexer.c had duplicate initialization code with pack.c)
* fix Win32 `pthread_join` error checking

This should be a decent improvement to behavior in threaded environments with a fairly small net gain in lines of code (mostly thanks to some of the structure initialization consolidation that I had to do).