summaryrefslogtreecommitdiff
path: root/src/pack.h
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-04-12 12:59:38 -0700
committerVicent Marti <tanoku@gmail.com>2013-04-22 16:50:51 +0200
commit24c70804e87523df99f4740ed2829976ec1a9c1b (patch)
treef0a5fb956f19a241971ade02772dca89b6a811d5 /src/pack.h
parentb12b72ea82776bbbd4296eeac1376055b0487edf (diff)
downloadlibgit2-24c70804e87523df99f4740ed2829976ec1a9c1b.tar.gz
Add mutex around mapping and unmapping pack files
When I was writing threading tests for the new cache, the main error I kept running into was a pack file having it's content unmapped underneath the running thread. This adds a lock around the routines that map and unmap the pack data so that threads can effectively reload the data when they need it. This also required reworking the error handling paths in a couple places in the code which I tried to make consistent.
Diffstat (limited to 'src/pack.h')
-rw-r--r--src/pack.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/pack.h b/src/pack.h
index 8d7e33dfe..b734ac163 100644
--- a/src/pack.h
+++ b/src/pack.h
@@ -79,6 +79,7 @@ typedef struct {
struct git_pack_file {
git_mwindow_file mwf;
git_map index_map;
+ git_mutex lock;
uint32_t num_objects;
uint32_t num_bad_objects;