Re: Patches for review: vat shutdown
Thomas Leonard <[email protected]>
| Newsgroups | gmane.comp.lang.e.general |
|---|---|
| Message-ID | <[email protected]> |
On 25 October 2010 16:48, Bill Frantz <[email protected]> wrote: > On 10/25/10 at 3:16 AM, [email protected] (Thomas > Leonard) wrote: > >>2. Removed UserThread that was created per ListenThread >> >>http://gitorious.org/~tal-itinnov/repo-roscidus/it-innovation/commit/ >>f5f366d279be6343a92d3eaddd43a4d951f12bc6 >> >>(unless someone can explain what this was for) > > From the Javadoc for ListenThread: > > HACK: The listener thread needs to be a daemon thread, because > if it were a user thread it would be uninteruptible while it was > off waiting on an accept() (this is due to a flaw in Solaris, > actually). However, if it's a daemon thread the app can exit > even if the thread is still running. However, if we're just > sitting there waiting for connections to arrive over the > network, we don't want to exit, we want to keep running. Thus we > have the net.vattp.data.UserThread, which does NOTHING but wait. > Since it's a user thread it keeps the app from exiting (and thus > allows the listener thread to keep running waiting for a > connection) and since it's not waiting on an accept we can kill > it. When we tell the listener thread to shutdown (which we now > can do since it's a daemon thread), it sends a notify() to the > listener user thread whereupon *it* shuts down too. Hallelujah, amen. > > > It seems to me that if the Solaris bug has been fixed, the hack > (and UserThread) can be removed. My question is more why this behaviour was desired in the first place. Why should a ListenThread keep the JVM alive, if there are no user threads around? There must be a thread to process the events that the ListenThread will generate (i.e. ListenThread.myVat) - shouldn't that do the job? That is, why not keep ListenThread as a daemon thread (avoiding the Solaris bug, if it still exists) but just drop the UserThread entirely? -- Dr Thomas Leonard http://0install.net/ GPG: 9242 9807 C985 3C07 44A6 8B9A AE07 8280 59A5 3CC1 GPG: DA98 25AE CAD0 8975 7CDA BD8E 0713 3F96 CA74 D8BA _______________________________________________ e-lang mailing list [email protected] http://www.eros-os.org/mailman/listinfo/e-lang