以下是窗体的按钮代码:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
myth()
End Sub
End Class
以下是模块的代码:
Module Module1
Dim t1 As Threading.Thread
Dim t2 As Threading.Thread
Dim a As Integer, b As Integer
Sub myth()
t1 = New Threading.Thread(AddressOf setA)
t1.Start()
t2 = New Threading.Thread(AddressOf setB)
t2.Start()
MessageBox.Show("a=" & a & ",b=" & b)
End Sub
Private Sub setA()
a = 1
End Sub
Private Sub setB()
b = 2
End Sub
End Module
请在过程myth中做线程池的代码而取代以下过程myth中的代码:
t1 = New Threading.Thread(AddressOf setA)
t1.Start()
t2 = New Threading.Thread(AddressOf setB)
t2.Start()