docs(_withcontent): _init_tls 守卫注释更新为双保险
TPV 已正式实现 @t.TLS(FuncGenMixin.translate_function_def 与 ClassGenMixin._translate_method 生成 __tls_init_done 全局标志 + skip/cont 块,对齐 TPC HandlesFunctions.py L1763-1792);此判重 守卫保留以兼容未重建的旧 TPV.exe。
This commit is contained in:
1 parent
6759406a7e
commit
5d660a5448
1 file changed
+3
-4
@@ -26,10 +26,9 @@ _tls_index: ULONG = 0
|
||||
def _init_tls():
|
||||
"""Initialize TLS index (executes once; subsequent calls are skipped)."""
|
||||
global _tls_index
|
||||
# TPV 未实现 @t.TLS 的"首次执行"守卫(函数每次调用都执行体),
|
||||
# 不加守卫会导致每次 _get_stack 都 TlsAlloc 新索引 → 每次拿到新
|
||||
# 空栈 → push/find 各用各的栈,provider 永远匹配失败。_tls_index
|
||||
# 初始为 0(TlsAlloc 成功不会返回 0),以此判重即等价 TLS 语义。
|
||||
# 双保险:TPV 已正式实现 @t.TLS(函数级一次性守卫,首次执行后置
|
||||
# __tls_init_done 标志,后续调用直接返回),此判重守卫保留以兼容
|
||||
# 尚未重建的旧 TPV.exe。_tls_index 初始为 0(TlsAlloc 成功不会返回 0)。
|
||||
if _tls_index == 0:
|
||||
_tls_index = TlsAlloc()
|
||||
|
||||
|
||||
Reference in new issue
Block a user