Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mutually Exclusive lock

 
Wilson Mui
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does that term mean in terms of threading?
 
Marlene Miller
Ranch Hand
Posts: 1392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Every object has a lock associated with it.
If one thread invokes a synchronized method on an object, the lock of that object is first acquired, the method body is executed, and then the lock is released. Another thread invoking a synchronized method on that same object will block until the lock is released.
Only one thread at a time can acquire the lock of an object.
(In the Java Programming Language, they say the execution of two threads is mutually exclusive, not the lock.)
[ May 08, 2003: Message edited by: Marlene Miller ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic