< prev index next >

src/hotspot/share/prims/jvmtiRawMonitor.cpp

Print this page




   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 "memory/allocation.inline.hpp"
  27 #include "prims/jvmtiRawMonitor.hpp"
  28 #include "runtime/atomic.hpp"
  29 #include "runtime/interfaceSupport.hpp"
  30 #include "runtime/orderAccess.inline.hpp"
  31 #include "runtime/thread.inline.hpp"
  32 
  33 GrowableArray<JvmtiRawMonitor*> *JvmtiPendingMonitors::_monitors = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<JvmtiRawMonitor*>(1,true);
  34 
  35 void JvmtiPendingMonitors::transition_raw_monitors() {
  36   assert((Threads::number_of_threads()==1),
  37          "Java thread has not created yet or more than one java thread \
  38 is running. Raw monitor transition will not work");
  39   JavaThread *current_java_thread = JavaThread::current();
  40   assert(current_java_thread->thread_state() == _thread_in_vm, "Must be in vm");
  41   {
  42     ThreadBlockInVM __tbivm(current_java_thread);
  43     for(int i=0; i< count(); i++) {
  44       JvmtiRawMonitor *rmonitor = monitors()->at(i);
  45       int r = rmonitor->raw_enter(current_java_thread);
  46       assert(r == ObjectMonitor::OM_OK, "raw_enter should have worked");
  47     }
  48   }
  49   // pending monitors are converted to real monitor so delete them all.




   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 "memory/allocation.inline.hpp"
  27 #include "prims/jvmtiRawMonitor.hpp"
  28 #include "runtime/atomic.hpp"
  29 #include "runtime/interfaceSupport.inline.hpp"
  30 #include "runtime/orderAccess.inline.hpp"
  31 #include "runtime/thread.inline.hpp"
  32 
  33 GrowableArray<JvmtiRawMonitor*> *JvmtiPendingMonitors::_monitors = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<JvmtiRawMonitor*>(1,true);
  34 
  35 void JvmtiPendingMonitors::transition_raw_monitors() {
  36   assert((Threads::number_of_threads()==1),
  37          "Java thread has not created yet or more than one java thread \
  38 is running. Raw monitor transition will not work");
  39   JavaThread *current_java_thread = JavaThread::current();
  40   assert(current_java_thread->thread_state() == _thread_in_vm, "Must be in vm");
  41   {
  42     ThreadBlockInVM __tbivm(current_java_thread);
  43     for(int i=0; i< count(); i++) {
  44       JvmtiRawMonitor *rmonitor = monitors()->at(i);
  45       int r = rmonitor->raw_enter(current_java_thread);
  46       assert(r == ObjectMonitor::OM_OK, "raw_enter should have worked");
  47     }
  48   }
  49   // pending monitors are converted to real monitor so delete them all.


< prev index next >