mirror of
https://github.com/GTNewHorizons/CodeChickenCore.git
synced 2026-11-11 15:57:42 +00:00
39 lines
648 B
Java
39 lines
648 B
Java
package codechicken.core;
|
|
|
|
public class ReentrantCheck
|
|
{
|
|
private boolean entered;
|
|
|
|
public ReentrantCheck()
|
|
{
|
|
entered = false;
|
|
}
|
|
|
|
public boolean entered()
|
|
{
|
|
return entered;
|
|
}
|
|
|
|
public void enter()
|
|
{
|
|
entered = true;
|
|
}
|
|
|
|
public void exit()
|
|
{
|
|
entered = false;
|
|
}
|
|
|
|
public static ThreadLocal<ReentrantCheck> threadLocal()
|
|
{
|
|
return new ThreadLocal<ReentrantCheck>()
|
|
{
|
|
@Override
|
|
protected ReentrantCheck initialValue()
|
|
{
|
|
return new ReentrantCheck();
|
|
}
|
|
};
|
|
}
|
|
}
|