The 30 second time-out was meant to give the reader thread a reasonable
time to finish what it is doing and shut itself down gracefully. Once it
times out, then it is forcefully shutdown as  a last resort. Normally, the
graceful shutdown should occur very rapidly. If you are just letting the
garbage collector clean things up on program termination, then your app
probably isn't doing any meaningful work so it should be fine to
 forcefully shut it down after a shorter timeout.


On Tue, Dec 3, 2013 at 10:28 PM, 汤・吉诃德 <[email protected]> wrote:

> Hi Jim, I want to use the temporary walkaround mentioned by the issue
> reporter, to reduce the timeout in the following code from 30 seconds to 2
> seconds:
>
> if(null != readThread)
> {
>       if(Thread.CurrentThread != readThread && readThread.IsAlive)
>       {
>               if(!readThread.Join((int) MAX_THREAD_WAIT.TotalMilliseconds))
>               {
>                       readThread.Abort();
>               }
>       }
>
>       readThread = null;
> }
>
> However, I am worried about my walkaround : Could there be any harm if I
> reduce the timeout ? By default, the code wait as long as 30 seconds for
> readThread to join. What is the purpose of such a behaviour ?What could
> keep readThread alive for 30 seconds while closing connection ? Is it OK to
> wait for a shorter timespan?
>

Reply via email to