Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit bbf3fb9

Browse files
author
Mengzuozhu
committed
fix AtomicIntegerArray index
1 parent 84fa469 commit bbf3fb9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

‎docs/java/Multithread/Atomic.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,8 +314,8 @@ public final int get(int i) //获取 index=i 位置元素的值
314314
public final int getAndSet(int i, int newValue)//返回 index=i 位置的当前的值,并将其设置为新值:newValue
315315
public final int getAndIncrement(int i)//获取 index=i 位置元素的值,并让该位置的元素自增
316316
public final int getAndDecrement(int i) //获取 index=i 位置元素的值,并让该位置的元素自减
317-
public final int getAndAdd(int delta) //获取 index=i 位置元素的值,并加上预期的值
318-
boolean compareAndSet(int expect, int update) //如果输入的数值等于预期值,则以原子方式将 index=i 位置的元素值设置为输入值(update)
317+
public final int getAndAdd(int i, intdelta) //获取 index=i 位置元素的值,并加上预期的值
318+
boolean compareAndSet(int i, intexpect, int update) //如果输入的数值等于预期值,则以原子方式将 index=i 位置的元素值设置为输入值(update)
319319
public final void lazySet(int i, int newValue)//最终 将index=i 位置的元素设置为newValue,使用 lazySet 设置之后可能导致其他线程在之后的一小段时间内还是可以读到旧的值。
320320
```
321321
#### 3.2 AtomicIntegerArray 常见方法使用

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /