Skip to content
This repository was archived by the owner on Feb 25, 2024. It is now read-only.

Commit 542d4ab

Browse files
committed
Move getAndBitwiseOr() back to SubmissionPublisher
1 parent 0e0fdd1 commit 542d4ab

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/main/java/java9/util/concurrent/SubmissionPublisher.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1034,12 +1034,25 @@ static final class BufferedSubscription<T>
10341034

10351035
// Wrappers for some VarHandle methods
10361036

1037+
/**
1038+
* Atomically sets the value of a variable to the result
1039+
* of bitwise OR between the variable's current value and
1040+
* the mask with volatile memory semantics.
1041+
*/
1042+
static int getAndBitwiseOr(Object o, long offset, int mask) {
1043+
int oldVal;
1044+
do {
1045+
oldVal = U.getIntVolatile(o, offset);
1046+
} while (!U.compareAndSwapInt(o, offset, oldVal, oldVal | mask));
1047+
return oldVal;
1048+
}
1049+
10371050
final boolean weakCasCtl(int cmp, int val) {
10381051
return U.compareAndSwapInt(this, CTL, cmp, val);
10391052
}
10401053

10411054
final int getAndBitwiseOrCtl(int bits) {
1042-
return ForkJoinPool.getAndBitwiseOr(this, CTL, bits);
1055+
return getAndBitwiseOr(this, CTL, bits);
10431056
}
10441057

10451058
final long subtractDemand(int k) {

0 commit comments

Comments
 (0)