From: Michael Haggerty Date: Mon, 22 May 2017 14:17:39 +0000 (+0200) Subject: lockfile: add a new method, is_lock_file_locked() X-Git-Tag: v2.14.0-rc0~109^2~16 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0978f4ba7fe571d96b9f13827bdac6c30eeebfa2;p=git lockfile: add a new method, is_lock_file_locked() It will soon prove useful. Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- diff --git a/lockfile.h b/lockfile.h index 7b715f9e77..572064939c 100644 --- a/lockfile.h +++ b/lockfile.h @@ -175,6 +175,14 @@ static inline int hold_lock_file_for_update( return hold_lock_file_for_update_timeout(lk, path, flags, 0); } +/* + * Return a nonzero value iff `lk` is currently locked. + */ +static inline int is_lock_file_locked(struct lock_file *lk) +{ + return is_tempfile_active(&lk->tempfile); +} + /* * Append an appropriate error message to `buf` following the failure * of `hold_lock_file_for_update()` to lock `path`. `err` should be the