📄 instructions2.doc156.html
字号:
<html><head><title>VM Spec </title></head><body BGCOLOR=#eeeeff text=#000000 LINK=#0000ff VLINK=#000077 ALINK=#ff0000> <a href="VMSpecTOC.doc.html">Contents</a> | <a href="Instructions2.doc155.html">Prev</a> | <a href="Instructions2.doc157.html">Next</a> | <a href="Mnemonics.doc.html">Index</a><hr><br> <a name="monitorenter"></a><h2>monitorenter</h2><a name="monitorenter.Operation"></a><b>Operation</b><br><a name="69702"></a><p><Table Border="3"><tr><td><a name="69701"></a> <i>monitorenter</i><td><a name="87568"></a> </Table><Table><tr><td></Table>Enter monitor for object<p><a name="monitorenter.Forms"></a><b>Forms</b><br><a name="69703"></a><i>monitorenter</i> = 194 (0xc2)<p><a name="monitorenter.Stack"></a><b>Stack</b><br><a name="69704"></a>..., <i>objectref</i><em> </em><img src="chars/arrwdbrt.gif"> ... <p><a name="monitorenter.Description"></a><b>Description</b><br><a name="69705"></a>The <i>objectref</i> must be of type <code>reference</code>.<p><a name="69706"></a>Each object has a monitor associated with it. The thread that executes <i>monitorenter</i> gains ownership of the monitor associated with <i>objectref</i>. If another thread already owns the monitor associated with <i>objectref</i>, the current thread waits until the object is unlocked, then tries again to gain ownership. If the current thread already owns the monitor associated with <i>objectref</i>, it increments a counter in the monitor indicating the number of times this thread has entered the monitor. If the monitor associated with <i>objectref</i> is not owned by any thread, the current thread becomes the owner of the monitor, setting the entry count of this monitor to 1.<p><a name="monitorenter.Runtime"></a><b>Runtime Exception</b><br><a name="69708"></a>If <i>objectref</i><em> </em>is <code>null</code>, <i>monitorenter</i> throws a <code>NullPointerException</code>. <p><a name="monitorenter.Notes"></a><b>Notes</b><br><a name="131155"></a>For detailed information about threads and monitors in the Java Virtual Machine, see Chapter <a href="Threads.doc.html#21293">8</a>, <a href="Threads.doc.html#21294">"Threads and Locks."</a><p><hr><!-- This inserts footnotes--><p><a href="VMSpecTOC.doc.html">Contents</a> | <a href="Instructions2.doc155.html">Prev</a> | <a href="Instructions2.doc157.html">Next</a> | <a href="Mnemonics.doc.html">Index</a><p><font size=-1>Java Virtual Machine Specification (HTML generated by dkramer on February 25, 1997)<br><i><a href="Copyright.doc.html">Copyright © 1996 Sun Microsystems, Inc.</a>All rights reserved</i><br>Please send any comments or corrections to <a href="mailto:doug.kramer@sun.com">doug.kramer@sun.com</a></font></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -