本文整理汇总了VB.NET中System.Threading.Thread.Resume方法的典型用法代码示例。如果您正苦于以下问题:VB.NET Thread.Resume方法的具体用法?VB.NET Thread.Resume怎么用?VB.NET Thread.Resume使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Threading.Thread
的用法示例。
在下文中一共展示了Thread.Resume方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: Module1
' 导入命名空间
Imports System.Threading
Module Module1
Public A As Thread = New Thread(AddressOf MethodA)
Public B As Thread = New Thread(AddressOf MethodB)
Public C As Thread = New Thread(AddressOf MethodC)
Sub MethodA()
Dim I As Integer
Try
A.Suspend()
For I = 0 To 250
Console.Write("A")
Next
Catch E As ThreadStateException
Console.WriteLine("Thread A Expection" & E.ToString())
End Try
End Sub
Sub MethodB()
Dim I As Integer
Try
For I = 0 To 250
Console.Write("B")
Next
Catch E As ThreadAbortException
Console.Write("Thread B has been aborted")
End Try
End Sub
Sub MethodC()
Dim I As Integer
Try
If (B.IsAlive) Then
B.Abort()
End If
For I = 0 To 250
If (A.ThreadState = ThreadState.Suspended) Then
A.Resume()
End If
Console.Write("C")
Next
Catch E As Threading.ThreadStateException
Console.WriteLine("Thread C Expection" & E.ToString())
End Try
End Sub
Sub Main()
A.Start()
B.Start()
C.Start()
End Sub
End Module