[Mono-dev] [PATCH] Interrupting socket calls on Windows during shutdown.

Bill Holmes billholmes54 at gmail.com
Mon Jun 22 10:49:38 EDT 2009


We have run into another problem on Windows with socket calls on
background threads not stopping during shutdown.  The attached patch
sets a flag on the thread struct around the socket calls.  If this
flag is set when thread manage is called that thread will be killed
during the APC call.


This only applies to threads that are stopping (process shutdown) and
are background threads.


2009-06-22  Bill Holmes  <billholmes54 at gmail.com>

	* object-internals.h : Adding interrupt_on_stop field.

	* threads.c (mono_thread_request_interruption) : On Windows exit the
thread if interrupt_on_stop is set.

	* socket-io.c (ves_icall_System_Net_Sockets_Socket_Accept_internal) :
	  Removing old interrupt logic and setting the interrupt_on_stop for the
	  thread when calling accept.

	* socket-io.c (ves_icall_System_Net_Sockets_Socket_Receive_internal) :
	  setting the interrupt_on_stop for the thread when calling accept.

	* Thread.cs : Adding interrupt_on_stop field.

	Contributed under MIT/X11 license.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: socket_interrupt.patch
Type: application/octet-stream
Size: 4527 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20090622/23078141/attachment.obj 

More information about the Mono-devel-list mailing list