[dmd-concurrency] Shutdown protocol
Steve Schveighoffer
schveiguy at yahoo.com
Thu Jan 21 09:27:57 PST 2010
----- Original Message ----
> From: Andrei Alexandrescu <andrei at erdani.com>
> Steve Schveighoffer wrote:
> > ----- Original Message ----
> >
> >> From: Andrei Alexandrescu
> >>
> >> "The function terminates any pending operations on the handle and discards
> any outstanding data. If a thread is blocking a call to Wininet.dll, another
> thread in the application can call InternetCloseHandle on the Internet handle
> being used by the first thread to cancel the operation and unblock the first
> thread."
> >>
> >> This is why you can close a browser instantly even though there may be a
> dozen pages still waiting to load.
> >
> > I disagree. A browser "closing instantly" just means its UI is hidden. Watch
> the process in Task Manager, it lingers for quite a few seconds.
>
> The actual process shutdowns next to instantly on all my computers. I can say
> I'm positive it does not use the method you are suggesting in your other message
> (readWithShutdown).
>
I can't say what method it uses to shut down. I don't see how you can either unless you read the code.
What I can say is I've seen Firefox linger and even hang when I shut it down. Often times I accidentally shut down firefox, and go to reopen it in about 5 seconds, and it says it can't start because there's already a process running and that process is shutting down. Clearly it does some sort of cleanup, whether part of that is to wait for socket reads to time out, I'm not sure.
My larger point, however, is that the socket-shutdown facility you want to have is available to D applications. But making it a *required* part is too much. Maybe applications that don't shut down using this method don't make it on to your laptop, but that's hardly a reason to require all D applications to do it. You are not the only user of D applications, and web browsing is not the only use-case for threading and sockets.
-Steve
More information about the dmd-concurrency
mailing list