diff options
author | 2015-05-22 12:41:55 -0700 | |
---|---|---|
committer | 2015-05-22 12:41:55 -0700 | |
commit | fb257bfa174b00e236ac5d6f4282a487f10a9e98 (patch) | |
tree | 616da2c04e2140fe22bd4cfaf7f3b9b764d769c3 /lockfile.h | |
parent | Merge branch 'jk/add-e-kill-editor' (diff) | |
parent | lock_packed_refs(): allow retries when acquiring the packed-refs lock (diff) | |
download | tgif-fb257bfa174b00e236ac5d6f4282a487f10a9e98.tar.xz |
Merge branch 'mh/lockfile-retry'
Instead of dying immediately upon failing to obtain a lock, retry
after a short while with backoff.
* mh/lockfile-retry:
lock_packed_refs(): allow retries when acquiring the packed-refs lock
lockfile: allow file locking to be retried with a timeout
Diffstat (limited to 'lockfile.h')
-rw-r--r-- | lockfile.h | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lockfile.h b/lockfile.h index cd2ec95d30..b4abc61c00 100644 --- a/lockfile.h +++ b/lockfile.h @@ -74,8 +74,20 @@ struct lock_file { extern void unable_to_lock_message(const char *path, int err, struct strbuf *buf); extern NORETURN void unable_to_lock_die(const char *path, int err); -extern int hold_lock_file_for_update(struct lock_file *, const char *path, int); -extern int hold_lock_file_for_append(struct lock_file *, const char *path, int); +extern int hold_lock_file_for_update_timeout( + struct lock_file *lk, const char *path, + int flags, long timeout_ms); + +static inline int hold_lock_file_for_update( + struct lock_file *lk, const char *path, + int flags) +{ + return hold_lock_file_for_update_timeout(lk, path, flags, 0); +} + +extern int hold_lock_file_for_append(struct lock_file *lk, const char *path, + int flags); + extern FILE *fdopen_lock_file(struct lock_file *, const char *mode); extern char *get_locked_file_path(struct lock_file *); extern int commit_lock_file_to(struct lock_file *, const char *path); |