diff options
| author | Russell Belfer <rb@github.com> | 2014-02-11 14:45:37 -0800 |
|---|---|---|
| committer | Russell Belfer <rb@github.com> | 2014-04-17 14:43:45 -0700 |
| commit | 40ed499039f887ebcb0b5badf0157519148398b8 (patch) | |
| tree | abf8307b9960aed3eb6911fadc26bb0627b7ecf2 /src/attr_file.c | |
| parent | 3b4c401a38ce912d5be8c9bf4ab1c4912a4f08bd (diff) | |
| download | libgit2-40ed499039f887ebcb0b5badf0157519148398b8.tar.gz | |
Add diff threading tests and attr file cache locks
This adds a basic test of doing simultaneous diffs on multiple
threads and adds basic locking for the attr file cache because
that was the immediate problem that arose from these tests.
Diffstat (limited to 'src/attr_file.c')
| -rw-r--r-- | src/attr_file.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/attr_file.c b/src/attr_file.c index ea92336f7..695f661a8 100644 --- a/src/attr_file.c +++ b/src/attr_file.c @@ -23,6 +23,7 @@ int git_attr_file__new( attrs = git__calloc(1, sizeof(git_attr_file)); GITERR_CHECK_ALLOC(attrs); + GIT_REFCOUNT_INC(attrs); if (pool) attrs->pool = pool; @@ -152,11 +153,8 @@ void git_attr_file__clear_rules(git_attr_file *file) git_vector_free(&file->rules); } -void git_attr_file__free(git_attr_file *file) +static void attr_file_free(git_attr_file *file) { - if (!file) - return; - git_attr_file__clear_rules(file); if (file->pool_is_allocated) { @@ -168,6 +166,13 @@ void git_attr_file__free(git_attr_file *file) git__free(file); } +void git_attr_file__free(git_attr_file *file) +{ + if (!file) + return; + GIT_REFCOUNT_DEC(file, attr_file_free); +} + uint32_t git_attr_file__name_hash(const char *name) { uint32_t h = 5381; |
