lockfile: add a new method, is_lock_file_locked()
It will soon prove useful. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Michael Haggerty committed
May 22, 2017 at 16:17 UTC
0978f4ba7fe571d96b9f13827bdac6c30eeebfa2
1 file changed
+8
lockfile.h
+8
@@ -175,6 +175,14 @@ static inline int hold_lock_file_for_update(
175
return hold_lock_file_for_update_timeout(lk, path, flags, 0);
176
}
177
178
+/*
179
+ * Return a nonzero value iff `lk` is currently locked.
180
+ */
181
+static inline int is_lock_file_locked(struct lock_file *lk)
182
+{
183
+ return is_tempfile_active(&lk->tempfile);
184
+}
185
+
186
/*
187
* Append an appropriate error message to `buf` following the failure
188
* of `hold_lock_file_for_update()` to lock `path`. `err` should be the