From 805755f49b0db5bc884f8929621ac61238b2c30e Mon Sep 17 00:00:00 2001 From: Russell Belfer Date: Thu, 22 Aug 2013 15:44:34 -0700 Subject: Fix sortedcache docs and other feedback This converts an internal lock from a write lock to a read lock where write isn't needed, and also clarifies some doc things about where various locks are acquired and how various APIs are intended to be used. --- src/sortedcache.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/sortedcache.c') diff --git a/src/sortedcache.c b/src/sortedcache.c index 33171c48d..466e55dbe 100644 --- a/src/sortedcache.c +++ b/src/sortedcache.c @@ -110,7 +110,7 @@ static int sortedcache_copy_item(void *payload, void *tgt_item, void *src_item) int git_sortedcache_copy( git_sortedcache **out, git_sortedcache *src, - bool wlock, + bool lock, int (*copy_item)(void *payload, void *tgt_item, void *src_item), void *payload) { @@ -131,7 +131,7 @@ int git_sortedcache_copy( src->items._cmp, src->path)) < 0) return error; - if (wlock && git_sortedcache_wlock(src) < 0) { + if (lock && git_sortedcache_rlock(src) < 0) { git_sortedcache_free(tgt); return -1; } @@ -144,8 +144,8 @@ int git_sortedcache_copy( break; } - if (wlock) - git_sortedcache_wunlock(src); + if (lock) + git_sortedcache_runlock(src); if (error) git_sortedcache_free(tgt); -- cgit v1.2.1