Skip to content

Commit 0978f4b

Browse files
mhaggergitster
authored andcommitted
lockfile: add a new method, is_lock_file_locked()
It will soon prove useful. Signed-off-by: Michael Haggerty <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 64da419 commit 0978f4b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lockfile.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,14 @@ static inline int hold_lock_file_for_update(
175175
return hold_lock_file_for_update_timeout(lk, path, flags, 0);
176176
}
177177

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+
178186
/*
179187
* Append an appropriate error message to `buf` following the failure
180188
* of `hold_lock_file_for_update()` to lock `path`. `err` should be the

0 commit comments

Comments
 (0)