src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp

changeset 2242
cd3ef3fd20dd
parent 1907
c18cbe5936b8
child 2314
f95d63e2154a
     1.1 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp	Sat Oct 16 17:12:19 2010 -0400
     1.2 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp	Thu Oct 21 17:29:24 2010 -0700
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -272,12 +272,16 @@
    1.11    }
    1.12  }
    1.13  
    1.14 -// Wait until the next synchronous GC or a timeout, whichever is earlier.
    1.15 -void ConcurrentMarkSweepThread::wait_on_cms_lock(long t) {
    1.16 +// Wait until the next synchronous GC, a concurrent full gc request,
    1.17 +// or a timeout, whichever is earlier.
    1.18 +void ConcurrentMarkSweepThread::wait_on_cms_lock(long t_millis) {
    1.19    MutexLockerEx x(CGC_lock,
    1.20                    Mutex::_no_safepoint_check_flag);
    1.21 +  if (_should_terminate || _collector->_full_gc_requested) {
    1.22 +    return;
    1.23 +  }
    1.24    set_CMS_flag(CMS_cms_wants_token);   // to provoke notifies
    1.25 -  CGC_lock->wait(Mutex::_no_safepoint_check_flag, t);
    1.26 +  CGC_lock->wait(Mutex::_no_safepoint_check_flag, t_millis);
    1.27    clear_CMS_flag(CMS_cms_wants_token);
    1.28    assert(!CMS_flag_is_set(CMS_cms_has_token | CMS_cms_wants_token),
    1.29           "Should not be set");
    1.30 @@ -289,7 +293,8 @@
    1.31        icms_wait();
    1.32        return;
    1.33      } else {
    1.34 -      // Wait until the next synchronous GC or a timeout, whichever is earlier
    1.35 +      // Wait until the next synchronous GC, a concurrent full gc
    1.36 +      // request or a timeout, whichever is earlier.
    1.37        wait_on_cms_lock(CMSWaitDuration);
    1.38      }
    1.39      // Check if we should start a CMS collection cycle

mercurial