* flock.cc (lf_setlock): Handle border case which results in WFMO loop
exiting with ret == WAIT_TIMEOUT gracefully. Add a system_printf to uncover other potential problems with WFMO loop.
This commit is contained in:
		| @@ -1,3 +1,9 @@ | |||||||
|  | 2009-04-20  Corinna Vinschen  <corinna@vinschen.de> | ||||||
|  |  | ||||||
|  | 	* flock.cc (lf_setlock): Handle border case which results in WFMO loop | ||||||
|  | 	exiting with ret == WAIT_TIMEOUT gracefully.  Add a system_printf to | ||||||
|  | 	uncover other potential problems with WFMO loop.  | ||||||
|  |  | ||||||
| 2009-04-18  Christopher Faylor  <me+cygwin@cgf.cx> | 2009-04-18  Christopher Faylor  <me+cygwin@cgf.cx> | ||||||
|  |  | ||||||
| 	* mkimport: Specify .text for stub explicitly. | 	* mkimport: Specify .text for stub explicitly. | ||||||
|   | |||||||
| @@ -971,6 +971,12 @@ lf_setlock (lockf_t *lock, inode_t *node, lockf_t **clean, HANDLE fhdl) | |||||||
| 	      ret = WaitForMultipleObjects (2, w4, FALSE, 100L); | 	      ret = WaitForMultipleObjects (2, w4, FALSE, 100L); | ||||||
| 	    } | 	    } | ||||||
| 	  while (ret == WAIT_TIMEOUT && get_obj_handle_count (obj) > 1); | 	  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->LOCK (); | ||||||
|       node->unwait (); |       node->unwait (); | ||||||
| @@ -991,6 +997,8 @@ lf_setlock (lockf_t *lock, inode_t *node, lockf_t **clean, HANDLE fhdl) | |||||||
| 	  _my_tls.call_signal_handler (); | 	  _my_tls.call_signal_handler (); | ||||||
| 	  return EINTR; | 	  return EINTR; | ||||||
| 	default: | 	default: | ||||||
|  | 	  system_printf ("Shouldn't happen! ret = %lu, error: %lu\n", | ||||||
|  | 			 ret, GetLastError ()); | ||||||
| 	  return geterrno_from_win_error (); | 	  return geterrno_from_win_error (); | ||||||
| 	} | 	} | ||||||
|     } |     } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user