 |
AppletTalk.com Java discussions newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Marco Guest
|
Posted: Thu Apr 20, 2006 6:12 am Post subject: synchronized |
|
|
1) Se un metodo A è synchronized, è possibile che due thread eseguano
contemporaneamente due istanze di dello STESSO metodo A (spero di no)?
2) Se un metodo A è synchronized, è possibile che un metodo B non
synchronized (conpreso run()) venga eseguito da un altro thread
contemporaneamente ad A finchè non richiama altri metodi synchronized (spero
di sì)? |
|
| Back to top |
|
 |
Vincent Vega Guest
|
Posted: Thu Apr 20, 2006 7:12 am Post subject: Re: synchronized |
|
|
Marco wrote:
| Quote: | 1) Se un metodo A è synchronized, è possibile che due thread eseguano
contemporaneamente due istanze di dello STESSO metodo A (spero di no)?
|
No.
| Quote: | 2) Se un metodo A è synchronized, è possibile che un metodo B non
synchronized (conpreso run()) venga eseguito da un altro thread
contemporaneamente ad A finchè non richiama altri metodi synchronized (spero
di sì)?
|
Esattamente così.
Precisando che quando parli di "altri metodi synchronized" si intende
dello stesso oggetto, i lock si applicano a livello di oggetto. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|