Skip to content

Commit

Permalink
removed unnecessary atomic boolean
Browse files Browse the repository at this point in the history
  • Loading branch information
codex128 committed Jun 27, 2024
1 parent 4c30527 commit d70e4cd
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import com.jme3.renderer.framegraph.definitions.ResourceDef;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.locks.ReentrantLock;

/**
* Represents an existing or future resource used for rendering.
Expand All @@ -53,7 +52,7 @@ public class RenderResource <T> {
private int refs = 0;
private boolean survivesRefCull = false;
private boolean undefined = false;
private final AtomicBoolean released = new AtomicBoolean(false);
private boolean released = false;

/**
*
Expand Down Expand Up @@ -84,8 +83,9 @@ public void reference(PassIndex index) {
* @return true if this resource is used after the release
*/
public boolean release() {
released.compareAndExchange(false, true);
return --refs >= 0;
refs--;
released = true;
return refs >= 0;
}

/**
Expand Down Expand Up @@ -279,7 +279,7 @@ public boolean isSurvivesRefCull() {
* @return
*/
public boolean isAvailable() {
return released.get();
return released;
}

@Override
Expand Down

0 comments on commit d70e4cd

Please sign in to comment.