fix(w32/condition/rwlock): SRWLOCK / CONDITION_VARIABLE 建模为不透明结构体
二者在 Windows 头文件里都是"单个 PVOID 的结构"(sizeof 8),API 收的是**存储地址**。 原先声明成 VOIDPTR(i8*)⇒ `c.Addr(self.cond_var)` 得到 i8**(多一层),与形参 i8* 层数 不符(指针隐式转换收紧后报 CastError,现场 includes/condition.vp:27)。 - win32sync.vp:新增 class SRWLOCK / class CONDITION_VARIABLE(Ptr: VOIDPTR,8 字节); 5 个 SRWLock extern 与 5 个条件变量 extern 的形参由 VOIDPTR 改为对应结构体指针 - condition.vp:cond_var 由 VOIDPTR 改为 CONDITION_VARIABLE - rwlock.vp:lock 由 VOIDPTR 改为 SRWLOCK 布局与运行期语义均不变(都是 8 字节、对齐 8,传的仍是那块存储的地址)。
This commit is contained in:
1 parent
6ff26a16b9
commit
85f67b5558
3 files changed
+24
-12
No files matched your search
@@ -2,6 +2,7 @@ import t, c
|
||||
from stdint import *
|
||||
from w32.win32base import *
|
||||
from w32.win32sync import (
|
||||
SRWLOCK,
|
||||
InitializeSRWLock,
|
||||
AcquireSRWLockExclusive, ReleaseSRWLockExclusive,
|
||||
AcquireSRWLockShared, ReleaseSRWLockShared
|
||||
@@ -20,7 +21,7 @@ class RWLock:
|
||||
# ... modify shared data
|
||||
rwlock.release_write()
|
||||
"""
|
||||
lock: VOIDPTR
|
||||
lock: SRWLOCK
|
||||
|
||||
def __init__(self):
|
||||
InitializeSRWLock(c.Addr(self.lock))
|
||||
|
||||
Reference in new issue
Block a user