Skip to content

Commit

Permalink
optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
sunmisc committed Dec 20, 2024
1 parent 4e506f3 commit b789de5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion eo-runtime/src/main/java/org/eolang/AtRho.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ public Phi get() {

@Override
public boolean put(final Phi phi) {
return this.rho.compareAndSet(null, phi);
return this.rho.get() == null && this.rho.compareAndSet(null, phi);
}
}
2 changes: 1 addition & 1 deletion eo-runtime/src/main/java/org/eolang/AtVoid.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public Phi get() {

@Override
public boolean put(final Phi phi) {
if (!this.object.compareAndSet(null, phi)) {
if (this.object.get() != null || !this.object.compareAndSet(null, phi)) {
throw new ExReadOnly(
String.format(
"This void attribute \"%s\" is already set, can't reset",
Expand Down

0 comments on commit b789de5

Please sign in to comment.