aspose file tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Mutually Exclusive lock Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Mutually Exclusive lock" Watch "Mutually Exclusive lock" New topic

Mutually Exclusive lock

Wilson Mui
Ranch Hand

Joined: Apr 09, 2003
Posts: 140
What does that term mean in terms of threading?
Marlene Miller
Ranch Hand

Joined: Mar 05, 2003
Posts: 1391
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 ]
It is sorta covered in the JavaRanch Style Guide.
subject: Mutually Exclusive lock