跳到主要内容

Thread.Release 解锁

🎯功能

解除互斥锁

注意

仅支持IOS版

📜语法

结果 = Thread.Release()

📥参数

📤返回

💡示例

  
Dim dzc = {"a":1}
Thread.SetShareVar("dzc",dzc)
Delay 1000
//启动线程可能有短暂延迟
Thread.Start (aaa)
Thread.Start (bbb)
Thread.Start (ccc)
//如果主线程停止,所有的子线程都会停止
Do
Delay 1000
Loop
Function aaa()
Do
Thread.Lock()
Dim dzc = Thread.GetShareVar("dzc")
TracePrint dzc["a"]
dzc["a"] = dzc["a"] + 1
Thread.SetShareVar "dzc", dzc
Thread.Release()
Delay 80
Loop
End Function
Function bbb()
Do
Thread.Lock()
Dim dzc = Thread.GetShareVar("dzc")
TracePrint dzc["a"]
dzc["a"] = dzc["a"] + 1
Thread.SetShareVar "dzc", dzc
Thread.Release()
Delay 90
Loop
End Function
Function ccc()
Do
Thread.Lock()
Dim dzc = Thread.GetShareVar("dzc")
TracePrint dzc["a"]
dzc["a"] = dzc["a"] + 1
Thread.SetShareVar "dzc", dzc
Thread.Release()
Delay 100
Loop
End Function

📘备注