winsup/cygwin ChangeLog fhandler ...

Daniel Colascione
Sun Dec 18 00:03:00 GMT 2011

On 12/16/11 11:01 PM, cgf wrote:
> CVSROOT:	/cvs/uberbaum
> Module name:	winsup
> Changes by:	cgf[SNIP] 2011-12-17 07:01:21

> 	(fhandler_base_overlapped::close): Cancel any ongoing I/O before closing.


+      /* Cancelling seems to be necessary for cases where a reader is
+	 still executing either in another thread or when a signal handler
               ^^^^^^^^^        ^^^^^^^^^^^^^^^^^
+	 performs a close.  */
+      CancelIo (get_io_handle ());

Are you sure you want to use CancelIo here? MSDN says this about the function:

> Cancels all pending input and output (I/O) operations that are
> issued by the calling thread for the specified file. The function
> does not cancel I/O operations that other threads issue for a file handle.

I think you want to call CancelIoEx here, passing NULL for its second parameter.
 CancelIoEx, however, is only available post-Vista, so I imagine you'd want to
fall back to CancelIo for XP, accepting that you can't cancel IO from another
thread, and that the mechanism will work only from a signal delivered to the
thread doing the IO.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 235 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the Cygwin-developers mailing list