This is the mail archive of the cygwin-developers mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: winsup/cygwin ChangeLog exceptions.cc fhandler ...


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.

> http://sourceware.org/cgi-bin/cvsweb.cgi/winsup/cygwin/fhandler.cc.diff?cvsroot=uberbaum&r1=1.418&r2=1.419

+      /* 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.



Attachment: signature.asc
Description: OpenPGP digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]