mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-10-23 00:28:02 +00:00
ATOMIC MAYHEM
This commit is contained in:
1 parent
b6592582b3
commit
58a5aaed30
17 files changed
+424
-476
No files matched your search
@@ -0,0 +1,38 @@
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class IrisLock
|
||||
{
|
||||
private final ReentrantLock lock;
|
||||
private final String name;
|
||||
private boolean disabled = false;
|
||||
|
||||
public IrisLock(String name)
|
||||
{
|
||||
this.name = name;
|
||||
lock = new ReentrantLock(false);
|
||||
}
|
||||
|
||||
public void lock()
|
||||
{
|
||||
if(disabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
lock.lock();
|
||||
}
|
||||
|
||||
public void unlock()
|
||||
{
|
||||
if(disabled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user