Skip to content

Commit 072ab33

Browse files
committed
フォーマット修正
1 parent 9600507 commit 072ab33

21 files changed

+80
-414
lines changed

Diff for: reference/atomic/atomic/atomic.md

+4-15
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,15 @@ atomic(const atomic&) = delete;
77
```
88
99
##atomicオブジェクトの構築
10-
11-
- <b>atomic() noexceptデフォルトコンストラクタ。atomicオブジェクトを未初期化状態にする(C言語との互換性のため)</b>
12-
- <b>constexpr atomic(T desired)desiredでオブジェクトを初期化する。この初期化はアトミック操作ではない。</b>
10+
- `atomic() noexcept`<br/>デフォルトコンストラクタ。`atomic`オブジェクトを未初期化状態にする(C言語との互換性のため)
11+
- `constexpr atomic(T desired)`<br/>`desired`でオブジェクトを初期化する。この初期化はアトミック操作ではない。
1312
1413
1514
##例外
16-
1715
投げない
1816
1917
2018
##例
21-
2219
```cpp
2320
#include <iostream>
2421
#include <atomic>
@@ -35,32 +32,24 @@ int main()
3532
}
3633
```
3734

38-
###出力
3935

40-
```cpp
36+
###出力
37+
```
4138
3
4239
```
4340

4441
##バージョン
45-
46-
4742
###言語
48-
49-
5043
- C++11
5144

52-
53-
5445
###処理系
55-
5646
- [Clang](/implementation#clang.md): ??
5747
- [GCC](/implementation#gcc.md):
5848
- [GCC, C++0x mode](/implementation#gcc.md): 4.7.0
5949
- [ICC](/implementation#icc.md): ??
6050
- [Visual C++](/implementation#visual_cpp.md) ??
6151

6252

63-
6453
##参照
6554

6655

Diff for: reference/atomic/atomic/compare_exchange_strong.md

+5-29
Original file line numberDiff line numberDiff line change
@@ -10,50 +10,37 @@ bool compare_exchange_strong(T& expected, T desired, memory_order order = memory
1010
* memory_order_seq_cst[link /reference/atomic/memory_order.md]
1111
1212
##概要
13-
14-
<b>強い比較で値を入れ替える</b>
15-
13+
強い比較で値を入れ替える
1614
1715
1816
##要件
19-
2017
`failure`が[`memory_order_release`](/reference/atomic/memory_order.md), [`memory_order_acq_rel`](/reference/atomic/memory_order.md)ではないこと。
2118
`failure`が`success`よりも強くないこと。
2219
2320
24-
2521
##効果
26-
2722
現在の値と`expected`をバイトレベルで等値比較を行う、`true`である場合は現在の値を`desired`で置き換え、`false`である場合は`expected`を現在の値で置き換える。
2823
バイト等値比較が`true`の場合は`success`メモリオーダー、`false`の場合は`failure`メモリオーダーに従って、アトミックに値の置き換えが行われる。メモリーダーが一つだけ指定された場合、`order`メモリーダーが使用される。
2924
3025
31-
3226
##戻り値
33-
3427
等値比較の結果が返される
3528
3629
37-
3830
##例外
39-
4031
投げない
4132
4233
43-
4434
##備考
45-
4635
この関数は、値が交換可能な場合はCAS操作が常に成功する。
47-
[`compare_exchange_weak`](/reference/atomic/atomic/compare_exchange_weak.md)()はより弱い命令であり、交換可能な場合でもCAS操作が失敗する可能性がある。
36+
[`compare_exchange_weak`](./compare_exchange_weak.md)()はより弱い命令であり、交換可能な場合でもCAS操作が失敗する可能性がある。
4837
4938
通常、CAS操作は、CASが成功するまでループさせる。
50-
しかし、もしCAS操作でSpurious Failureが発生しなければループさせる必要が無くなるといった状況であれば、`compare_exchange_strong``()`を使うことで効率良くCASを行うことができる。
51-
逆に言えば、そのような状況でないなら常にループで[compare_exchange_weak()](/reference/atomic/atomic/compare_exchange_weak.md)を利用すれば良い。
52-
39+
しかし、もしCAS操作でSpurious Failureが発生しなければループさせる必要が無くなるといった状況であれば、`compare_exchange_strong()`を使うことで効率良くCASを行うことができる。
40+
逆に言えば、そのような状況でないなら常にループで[`compare_exchange_weak()`](/reference/atomic/atomic/compare_exchange_weak.md)を利用すれば良い。
5341
5442
5543
##例
56-
5744
```cpp
5845
#include <iostream>
5946
#include <atomic>
@@ -81,37 +68,26 @@ int main()
8168
}
8269
```
8370
* compare_exchange_strong[color ff0000]
84-
* compare_exchange_strong[color ff0000]
8571

8672
###出力
87-
88-
```cpp
73+
```
8974
true 2 3
9075
false 3 3
9176
```
9277

9378
##バージョン
94-
95-
9679
###言語
97-
98-
9980
- C++11
10081

101-
102-
10382
###処理系
104-
10583
- [Clang](/implementation#clang.md): ??
10684
- [GCC](/implementation#gcc.md):
10785
- [GCC, C++0x mode](/implementation#gcc.md): 4.7.0
10886
- [ICC](/implementation#icc.md): ??
10987
- [Visual C++](/implementation#visual_cpp.md) ??
11088

11189

112-
11390
##参照
114-
11591
[atomic compare_exchange_weak/strong関数 - yohhoyの日記](http://d.hatena.ne.jp/yohhoy/20120725/p1)
11692
[N2748 Strong Compare and Exchange](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2748.html)
11793
[cbloom rants: 07-14-11 - compare_exchange_strong vs compare_exchange_weak](http://cbloomrants.blogspot.jp/2011/07/07-14-11-compareexchangestrong-vs.html)

Diff for: reference/atomic/atomic/compare_exchange_weak.md

+5-25
Original file line numberDiff line numberDiff line change
@@ -10,48 +10,40 @@ bool compare_exchange_weak(T& expected, T desired, memory_order order = memory_o
1010
* memory_order_seq_cst[link /reference/atomic/memory_order.md]
1111
1212
##概要
13-
14-
<b>弱い比較で値を入れ替える</b>
13+
弱い比較で値を入れ替える
1514
1615
1716
##要件
18-
1917
`failure`が[`memory_order_release`](/reference/atomic/memory_order.md), [`memory_order_acq_rel`](/reference/atomic/memory_order.md)ではないこと。
20-
2118
`failure`が`success`よりも強くないこと。
2219
2320
2421
##効果
25-
2622
現在の値と`expected`をバイトレベルで等値比較を行い、`true`である場合は現在の値を`desired`で置き換え、`false`である場合は`expected`を現在の値で置き換える。
2723
2824
バイト等値比較が`true`の場合は`success`メモリオーダー、`false`の場合は`failure`メモリオーダーに従って、アトミックに値の置き換えが行われる。メモリーダーが一つだけ指定された場合、`order`メモリーダーが使用される。
2925
3026
3127
##戻り値
32-
3328
等値比較の結果が返される
3429
3530
3631
##例外
37-
3832
投げない
3933
4034
4135
##備考
42-
4336
この関数は、値が交換可能な場合でもCAS操作が失敗する可能性がある(Spurious Failure)。
44-
[`compare_exchange_strong`](/reference/atomic/atomic/compare_exchange_strong.md)()はより強い命令であり、交換可能な場合はCAS操作が常に成功する。
37+
[`compare_exchange_strong`](./compare_exchange_strong.md)()はより強い命令であり、交換可能な場合はCAS操作が常に成功する。
4538
46-
アーキテクチャによっては、この関数は[`compare_exchange_strong`](/reference/atomic/atomic/compare_exchange_strong.md)()と等価だが、PowerPCやARMなどLL/SC命令を提供するアーキテクチャの場合、この関数はハードウェアの“弱いLL/SC命令”にて実装されうる。[wikipedia:en:Load-link/store-conditional](http://en.wikipedia.org/wiki/Load-link%2Fstore-conditional), [wikipedia:Load-Link/Store-Conditional](http://ja.wikipedia.org/wiki/Load-Link%2FStore-Conditional) などを参照のこと。
39+
アーキテクチャによっては、この関数は[`compare_exchange_strong()`](./compare_exchange_strong.md)と等価だが、PowerPCやARMなどLL/SC命令を提供するアーキテクチャの場合、この関数はハードウェアの“弱いLL/SC命令”にて実装されうる。[wikipedia:en:Load-link/store-conditional](http://en.wikipedia.org/wiki/Load-link%2Fstore-conditional), [wikipedia:Load-Link/Store-Conditional](http://ja.wikipedia.org/wiki/Load-Link%2FStore-Conditional) などを参照のこと。
4740
4841
通常、CAS操作は、CASが成功するまでループさせる。
49-
しかし、もしCAS操作でSpurious Failureが発生しなければループさせる必要が無くなるといった状況であれば、[compare_exchange_strong()](/reference/atomic/atomic/compare_exchange_strong.md)を使うことで効率良くCASを行うことができる。
42+
しかし、もしCAS操作でSpurious Failureが発生しなければループさせる必要が無くなるといった状況であれば、[`compare_exchange_strong()`](./compare_exchange_strong.md)を使うことで効率良くCASを行うことができる。
5043
逆に言えば、そのような状況でないなら常にループで`compare_exchange_weak()`を利用すれば良い。
5144
5245
5346
##例
54-
5547
```cpp
5648
#include <iostream>
5749
#include <atomic>
@@ -78,40 +70,28 @@ int main()
7870
}
7971
}
8072
```
81-
* compare_exchange_weak(expected, 2);[color ff0000]
8273
* compare_exchange_weak[color ff0000]
8374

8475
###出力
85-
86-
```cpp
76+
```
8777
true 2 3
8878
false 3 3
8979
```
9080

9181
##バージョン
92-
93-
9482
###言語
95-
96-
9783
- C++11
9884

99-
100-
10185
###処理系
102-
10386
- [Clang](/implementation#clang.md): ??
10487
- [GCC](/implementation#gcc.md):
10588
- [GCC, C++0x mode](/implementation#gcc.md): 4.7.0
10689
- [ICC](/implementation#icc.md): ??
10790
- [Visual C++](/implementation#visual_cpp.md) ??
10891

10992

110-
11193
##参照
112-
11394
[atomic compare_exchange_weak/strong関数 - yohhoyの日記](http://d.hatena.ne.jp/yohhoy/20120725/p1)
114-
11595
[N2748 Strong Compare and Exchange](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2748.html)
11696
[cbloom rants: 07-14-11 - compare_exchange_strong vs compare_exchange_weak](http://cbloomrants.blogspot.jp/2011/07/07-14-11-compareexchangestrong-vs.html)
11797
[What does 'spurious failure' on a CAS mean? - StackOverflow](http://stackoverflow.com/q/355365/463412)

Diff for: reference/atomic/atomic/exchange.md

+4-16
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,22 @@ T exchange(T desired, memory_order order = memory_order_seq_cst) noexcept;
77
* memory_order_seq_cst[link /reference/atomic/memory_order.md]
88
99
##概要
10-
11-
<b>値を入れ替える</b>
10+
値を入れ替える
1211
1312
1413
##効果
15-
1614
`order`で指定されたメモリオーダーにしたがって、現在の値を`desired`でアトミックに置き換える
1715
1816
1917
##戻り値
20-
2118
変更前の値が返される
2219
2320
2421
##例外
25-
2622
投げない
2723
2824
2925
##例
30-
3126
```cpp
3227
#include <iostream>
3328
#include <atomic>
@@ -46,32 +41,25 @@ int main()
4641
```
4742
* exchange[color ff0000]
4843

49-
###出力
5044

51-
```cpp
45+
###出力
46+
```
5247
replaced 1 by 2
5348
```
5449

55-
##バージョン
56-
5750

51+
##バージョン
5852
###言語
59-
60-
6153
- C++11
6254

63-
64-
6555
###処理系
66-
6756
- [Clang](/implementation#clang.md): ??
6857
- [GCC](/implementation#gcc.md):
6958
- [GCC, C++0x mode](/implementation#gcc.md): 4.7.0
7059
- [ICC](/implementation#icc.md): ??
7160
- [Visual C++](/implementation#visual_cpp.md) ??
7261

7362

74-
7563
##参照
7664

7765

Diff for: reference/atomic/atomic/fetch_add.md

+4-21
Original file line numberDiff line numberDiff line change
@@ -7,36 +7,28 @@ T fetch_add(T operand, memory_order order = memory_order_seq_cst) noexcept;
77
* memory_order_seq_cst[link /reference/atomic/memory_order.md]
88
99
##概要
10-
11-
<b>加算を行う</b>
10+
加算を行う
1211
1312
1413
##効果
15-
16-
`order`で指定されたメモリオーダーにしたがって、現在の値に`operandを加算した値`でアトミックに置き換える
17-
14+
`order`で指定されたメモリオーダーにしたがって、現在の値に`operand`を加算した値でアトミックに置き換える
1815
1916
2017
##戻り値
21-
2218
変更前の値が返される
2319
2420
25-
2621
##例外
27-
2822
投げない
2923
3024
3125
##備考
32-
3326
この関数は、`atomic`クラスの整数型およびポインタに対する特殊化で定義される。
3427
3528
符号付き整数型に対しては、2の補数表現による演算が行われ、未定義動作はない。アドレス型に関しては結果として未定義アドレスになる場合があるが、それ以外の未定義動作はない。
3629
3730
3831
##例
39-
4032
```cpp
4133
#include <iostream>
4234
#include <atomic>
@@ -53,33 +45,24 @@ int main()
5345
```
5446
* fetch_add[color ff0000]
5547

56-
###出力
5748

58-
```cpp
49+
###出力
50+
```
5951
3
6052
5
6153
```
6254

6355
##バージョン
64-
65-
6656
###言語
67-
68-
6957
- C++11
7058

71-
72-
7359
###処理系
74-
7560
- [Clang](/implementation#clang.md): ??
7661
- [GCC](/implementation#gcc.md):
7762
- [GCC, C++0x mode](/implementation#gcc.md): 4.7.0
7863
- [ICC](/implementation#icc.md): ??
7964
- [Visual C++](/implementation#visual_cpp.md) ??
8065

81-
82-
8366
##参照
8467

8568

0 commit comments

Comments
 (0)