Commit 13975c3
Thread: native_thread_id・thread_variables・each_caller_location を追加
実機で登場バージョンを確認し、#@SInCE で分岐した。
3.0 以前から存在:
Thread#thread_variables スレッドローカル変数名の一覧
3.1 で追加:
Thread#native_thread_id ネイティブスレッドの ID
3.4 で追加:
Thread.each_caller_location 実行スタックを配列を作らず順に渡す
配置は関連メソッドの近くにした。thread_variables は
thread_variable_set / thread_variable? の並び、native_thread_id は
その直後、each_caller_location は Singleton Methods の Thread.stop の後。
thread_variables は既に Thread#thread_variable_set の例
(p thr.thread_variables) で使われていたが独立した項目が無かった。
その例の出力は rdoc 由来で [:dog, :cat] だったが、実機は挿入順の
[:cat, :dog] を返す (2.7〜4.0 で確認)。新設の項目と食い違わないよう、
既存の例も [:cat, :dog] に直し、SEE に thread_variables を足した。
native_thread_id の返り値は OS 依存で、その他のプラットフォームでは
NotImplementedError、ネイティブスレッドと未結合/切り離し済みなら nil に
なることを記載した。死んだスレッドで nil が返ることは実機で確認済み。
each_caller_location は Kernel#caller_locations と同じ引数 (start/length,
range) を取れることを C 実装 (vm_backtrace.c の ec_backtrace_range) で
確認し、シグネチャに反映した。
bitclust のデータベース生成を 3.0 / 3.1 / 3.3 / 3.4 / 4.0 で実行してエラーが
出ないこと、登録されるメソッドが 1 / 2 / 2 / 3 / 3 件と追加バージョンどおりに
なることを確認済み。サンプルコードは対象の全バージョンで実行して出力を確認した。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 5bcc2e4 commit 13975c3
1 file changed
Lines changed: 74 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
259 | 259 | | |
260 | 260 | | |
261 | 261 | | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
262 | 290 | | |
263 | 291 | | |
264 | 292 | | |
| |||
1079 | 1107 | | |
1080 | 1108 | | |
1081 | 1109 | | |
1082 | | - | |
| 1110 | + | |
1083 | 1111 | | |
1084 | 1112 | | |
1085 | | - | |
| 1113 | + | |
1086 | 1114 | | |
1087 | 1115 | | |
1088 | 1116 | | |
| |||
1103 | 1131 | | |
1104 | 1132 | | |
1105 | 1133 | | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
1106 | 1178 | | |
1107 | 1179 | | |
1108 | 1180 | | |
| |||
0 commit comments