/[classpath]/classpath/java/lang/Runtime.java
ViewVC logotype

Diff of /classpath/java/lang/Runtime.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.13 by jfrijters, Tue Dec 28 10:28:27 2004 UTC revision 1.14 by jfrijters, Tue Dec 28 12:50:51 2004 UTC
# Line 158  public class Runtime Line 158  public class Runtime
158          if (shutdownHooks != null)          if (shutdownHooks != null)
159            {            {
160              shutdownHooks.remove(Thread.currentThread());              shutdownHooks.remove(Thread.currentThread());
161              // Shutdown hooks are still running, so we clear status to              // Interrupt the exit sequence thread, in case it was waiting
162                // inside a join on our thread.
163                exitSequence.interrupt();
164                // Shutdown hooks are still running, so we clear status to
165              // make sure we don't halt.              // make sure we don't halt.
166              status = 0;              status = 0;
167            }            }
# Line 224  public class Runtime Line 227  public class Runtime
227              // itself from the set, then waits indefinitely on the              // itself from the set, then waits indefinitely on the
228              // exitSequence thread. Once the set is empty, set it to null to              // exitSequence thread. Once the set is empty, set it to null to
229              // signal all finalizer threads that halt may be called.              // signal all finalizer threads that halt may be called.
230              while (! shutdownHooks.isEmpty())              while (true)
231                {                {
232                  Thread[] hooks;                  Thread[] hooks;
233                  synchronized (libpath)                  synchronized (libpath)
# Line 232  public class Runtime Line 235  public class Runtime
235                      hooks = new Thread[shutdownHooks.size()];                      hooks = new Thread[shutdownHooks.size()];
236                      shutdownHooks.toArray(hooks);                      shutdownHooks.toArray(hooks);
237                    }                    }
238                  for (int i = hooks.length; --i >= 0; )                  if (hooks.length == 0)
239                    if (! hooks[i].isAlive())                    break;
240                      synchronized (libpath)                  for (int i = 0; i < hooks.length; i++)
241                      {
242                        try
243                        {                        {
244                          shutdownHooks.remove(hooks[i]);                          synchronized (libpath)
245                              {
246                                if (!shutdownHooks.contains(hooks[i]))
247                                  continue;
248                              }
249                            hooks[i].join();
250                            synchronized (libpath)
251                              {
252                                shutdownHooks.remove(hooks[i]);
253                              }
254                        }                        }
255                        catch (InterruptedException x)
256                      Thread.yield(); // Give other threads a chance.                        {
257                            // continue waiting on the next thread
258                          }
259                      }
260                }                }
261              synchronized (libpath)              synchronized (libpath)
262                {                {

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26