src/share/vm/gc_implementation/shared/concurrentGCThread.hpp

Print this page


   1 /*
   2  * Copyright (c) 2001, 2009, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 







  25 class VoidClosure;
  26 
  27 // A SuspendibleThreadSet is (obviously) a set of threads that can be
  28 // suspended.  A thread can join and later leave the set, and periodically
  29 // yield.  If some thread (not in the set) requests, via suspend_all, that
  30 // the threads be suspended, then the requesting thread is blocked until
  31 // all the threads in the set have yielded or left the set.  (Threads may
  32 // not enter the set when an attempted suspension is in progress.)  The
  33 // suspending thread later calls resume_all, allowing the suspended threads
  34 // to continue.
  35 
  36 class SuspendibleThreadSet {
  37   Monitor* _m;
  38   int      _async;
  39   bool     _async_stop;
  40   int      _async_stopped;
  41   bool     _initialized;
  42   double   _suspend_all_start;
  43 
  44   void initialize_work();


 148     releaseAndNotifyPLL  // notify and release pending list lock
 149   };
 150  private:
 151   // the following are shared with the CMSThread
 152   SLT_msg_type  _buffer;  // communication buffer
 153   Monitor       _monitor; // monitor controlling buffer
 154   BasicLock     _basicLock; // used for PLL locking
 155 
 156  public:
 157   static SurrogateLockerThread* make(TRAPS);
 158 
 159   SurrogateLockerThread();
 160 
 161   bool is_hidden_from_external_view() const     { return true; }
 162 
 163   void loop(); // main method
 164 
 165   void manipulatePLL(SLT_msg_type msg);
 166 
 167 };


   1 /*
   2  * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_GC_IMPLEMENTATION_SHARED_CONCURRENTGCTHREAD_HPP
  26 #define SHARE_VM_GC_IMPLEMENTATION_SHARED_CONCURRENTGCTHREAD_HPP
  27 
  28 #ifndef SERIALGC
  29 #include "runtime/thread.hpp"
  30 #endif
  31 
  32 class VoidClosure;
  33 
  34 // A SuspendibleThreadSet is (obviously) a set of threads that can be
  35 // suspended.  A thread can join and later leave the set, and periodically
  36 // yield.  If some thread (not in the set) requests, via suspend_all, that
  37 // the threads be suspended, then the requesting thread is blocked until
  38 // all the threads in the set have yielded or left the set.  (Threads may
  39 // not enter the set when an attempted suspension is in progress.)  The
  40 // suspending thread later calls resume_all, allowing the suspended threads
  41 // to continue.
  42 
  43 class SuspendibleThreadSet {
  44   Monitor* _m;
  45   int      _async;
  46   bool     _async_stop;
  47   int      _async_stopped;
  48   bool     _initialized;
  49   double   _suspend_all_start;
  50 
  51   void initialize_work();


 155     releaseAndNotifyPLL  // notify and release pending list lock
 156   };
 157  private:
 158   // the following are shared with the CMSThread
 159   SLT_msg_type  _buffer;  // communication buffer
 160   Monitor       _monitor; // monitor controlling buffer
 161   BasicLock     _basicLock; // used for PLL locking
 162 
 163  public:
 164   static SurrogateLockerThread* make(TRAPS);
 165 
 166   SurrogateLockerThread();
 167 
 168   bool is_hidden_from_external_view() const     { return true; }
 169 
 170   void loop(); // main method
 171 
 172   void manipulatePLL(SLT_msg_type msg);
 173 
 174 };
 175 
 176 #endif // SHARE_VM_GC_IMPLEMENTATION_SHARED_CONCURRENTGCTHREAD_HPP