src/share/vm/runtime/park.cpp

Print this page




   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 
  26 # include "incls/_precompiled.incl"
  27 # include "incls/_park.cpp.incl"
  28 
  29 
  30 // Lifecycle management for TSM ParkEvents.
  31 // ParkEvents are type-stable (TSM).
  32 // In our particular implementation they happen to be immortal.
  33 //
  34 // We manage concurrency on the FreeList with a CAS-based
  35 // detach-modify-reattach idiom that avoids the ABA problems
  36 // that would otherwise be present in a simple CAS-based
  37 // push-pop implementation.   (push-one and pop-all)
  38 //
  39 // Caveat: Allocate() and Release() may be called from threads
  40 // other than the thread associated with the Event!
  41 // If we need to call Allocate() when running as the thread in
  42 // question then look for the PD calls to initialize native TLS.
  43 // Native TLS (Win32/Linux/Solaris) can only be initialized or
  44 // accessed by the associated thread.
  45 // See also pd_initialize().
  46 //
  47 // Note that we could defer associating a ParkEvent with a thread




   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 #include "precompiled.hpp"
  26 #include "runtime/thread.hpp"
  27 


  28 
  29 
  30 // Lifecycle management for TSM ParkEvents.
  31 // ParkEvents are type-stable (TSM).
  32 // In our particular implementation they happen to be immortal.
  33 //
  34 // We manage concurrency on the FreeList with a CAS-based
  35 // detach-modify-reattach idiom that avoids the ABA problems
  36 // that would otherwise be present in a simple CAS-based
  37 // push-pop implementation.   (push-one and pop-all)
  38 //
  39 // Caveat: Allocate() and Release() may be called from threads
  40 // other than the thread associated with the Event!
  41 // If we need to call Allocate() when running as the thread in
  42 // question then look for the PD calls to initialize native TLS.
  43 // Native TLS (Win32/Linux/Solaris) can only be initialized or
  44 // accessed by the associated thread.
  45 // See also pd_initialize().
  46 //
  47 // Note that we could defer associating a ParkEvent with a thread