Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Java Machine > Re: Synchronize...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 3 Topic 788 of 816
Post > Topic >>

Re: Synchronized implementations

by Barb Knox <see@[EMAIL PROTECTED] > Sep 13, 2007 at 08:33 PM

In article <Hl0Gi.6837$cy3.591@[EMAIL PROTECTED]
>,
 Joshua Cranmer <Pidgeot18@[EMAIL PROTECTED]
> wrote:

> I have noticed a few times that Java implements synchronized blocks
thusly:
> 
> aload 4
> dup
> astore 5
> monitorenter
> [ various instructions ]
> aload 5
> monitorexit
> 
> Why does it duplicate the variable when running synchronized blocks?

Because you might have code like this:
    synchronized (something) {
        ...
        something := somethingElse;
        ...
    }

-- 
---------------------------
|  BBB                b    \     Barbara at LivingHistory stop co stop uk
|  B  B   aa     rrr  b     |
|  BBB   a  a   r     bbb   |    Quidquid latine dictum sit,
|  B  B  a  a   r     b  b  |    altum viditur.
|  BBB    aa a  r     bbb   |   
-----------------------------
 




 3 Posts in Topic:
Synchronized implementations
Joshua Cranmer <Pidgeo  2007-09-13 01:27:03 
Re: Synchronized implementations
Roedy Green <see_websi  2007-09-13 07:16:13 
Re: Synchronized implementations
Barb Knox <see@[EMAIL   2007-09-13 20:33:33 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 17:38:18 CDT 2008.