summaryrefslogtreecommitdiff
path: root/src/attr_file.h
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2014-04-14 12:31:17 -0700
committerRussell Belfer <rb@github.com>2014-04-17 14:56:41 -0700
commite6e8530aa6c8773dd523fd6fe07629b9481a8fee (patch)
treeaed0dba8c285b5765e8fed55939e8136c31a887b /src/attr_file.h
parentea642d61f9b3dd3d9e1670621198483541cf4f0d (diff)
downloadlibgit2-e6e8530aa6c8773dd523fd6fe07629b9481a8fee.tar.gz
Lock attribute file while reparsing data
I don't love this approach, but achieving thread-safety for attribute and ignore data while reloading files would require a larger rewrite in order to avoid this. If an attribute or ignore file is out of date, this holds a lock on the file while we are reloading the data so that another thread won't try to reload the data at the same time.
Diffstat (limited to 'src/attr_file.h')
-rw-r--r--src/attr_file.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/attr_file.h b/src/attr_file.h
index f92ce3c96..9b4b8724b 100644
--- a/src/attr_file.h
+++ b/src/attr_file.h
@@ -66,6 +66,7 @@ typedef struct {
struct git_attr_file {
git_refcount rc;
+ git_mutex lock;
git_attr_cache_entry *ce;
git_attr_cache_source source;
git_vector rules; /* vector of <rule*> or <fnmatch*> */
@@ -115,7 +116,8 @@ int git_attr_file__parse_buffer(
const char *data,
void *payload);
-void git_attr_file__clear_rules(git_attr_file *file);
+int git_attr_file__clear_rules(
+ git_attr_file *file, bool need_lock);
int git_attr_file__lookup_one(
git_attr_file *file,