changeset 7456:8af71985e97b HEAD

Comment updates
author Timo Sirainen <tss@iki.fi>
date Thu, 24 Apr 2008 16:56:10 +0300
parents 0dbf10f4493a
children 940641318f12
files src/lib/file-dotlock.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/file-dotlock.c	Thu Apr 24 16:31:07 2008 +0300
+++ b/src/lib/file-dotlock.c	Thu Apr 24 16:56:10 2008 +0300
@@ -236,8 +236,10 @@
 	if (lock_info->have_pid) {
 		/* we've local PID. Check if it exists. */
 		if (kill(pid, 0) == 0 || errno != ESRCH) {
-			if (pid != getpid())
+			if (pid != getpid()) {
+				/* process exists, don't override */
 				return 0;
+			}
 			/* it's us. either we're locking it again, or it's a
 			   stale lock file with same pid than us. either way,
 			   recreate it.. */
@@ -434,6 +436,8 @@
 		usleep(LOCK_RANDOM_USLEEP_TIME);
 		return;
 	}
+	/* timeout after a random time even when using notify, since it
+	   doesn't work reliably with e.g. NFS. */
 	to = timeout_add(LOCK_RANDOM_USLEEP_TIME/1000,
 			 dotlock_wait_end, ioloop);
 	io_loop_run(ioloop);