A-M baby
This commit is contained in:
parent
764da6cbbb
commit
db842d013d
19005 changed files with 197040 additions and 7 deletions
10
Task/Mutex/Java/mutex-2.java
Normal file
10
Task/Mutex/Java/mutex-2.java
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
public class TestVolitileClass throws Exception{
|
||||
public static void main(String[] args){
|
||||
VolatileClass vc = new VolatileClass();
|
||||
vc.mutex.acquire(); //will wait automatically if another class has the mutex
|
||||
//can be interrupted similarly to a Thread
|
||||
//use acquireUninterruptibly() to avoid that
|
||||
vc.needsToBeSynched();
|
||||
vc.mutex.release();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue