Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/flock.cc')
-rw-r--r--winsup/cygwin/flock.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/winsup/cygwin/flock.cc b/winsup/cygwin/flock.cc
index e17166044..8fd71391a 100644
--- a/winsup/cygwin/flock.cc
+++ b/winsup/cygwin/flock.cc
@@ -971,6 +971,12 @@ lf_setlock (lockf_t *lock, inode_t *node, lockf_t **clean, HANDLE fhdl)
ret = WaitForMultipleObjects (2, w4, FALSE, 100L);
}
while (ret == WAIT_TIMEOUT && get_obj_handle_count (obj) > 1);
+ /* There's a good chance that the above loop is left with
+ ret == WAIT_TIMEOUT if another process closes the file handle
+ associated with this lock. This is for all practical purposes
+ equivalent to a signalled lock object. */
+ if (ret == WAIT_TIMEOUT)
+ ret = WAIT_OBJECT_0;
}
node->LOCK ();
node->unwait ();
@@ -991,6 +997,8 @@ lf_setlock (lockf_t *lock, inode_t *node, lockf_t **clean, HANDLE fhdl)
_my_tls.call_signal_handler ();
return EINTR;
default:
+ system_printf ("Shouldn't happen! ret = %lu, error: %lu\n",
+ ret, GetLastError ());
return geterrno_from_win_error ();
}
}