文件打开后使用完要及时关闭。
成都创新互联是一家集网站建设,桑日企业网站建设,桑日品牌网站建设,网站定制,桑日网站建设报价,网络营销,网络优化,桑日网站推广为一体的创新建站企业,帮助传统企业提升企业形象加强企业竞争力。可充分满足这一群体相比中小企业更为丰富、高端、多元的互联网需求。同时我们时刻保持专业、时尚、前沿,时刻以成就客户成长自我,坚持不断学习、思考、沉淀、净化自己,让我们为更多的企业打造出实用型网站。
未关闭,这样再打开就显示处于被占用状态。
下面的代码示例说明了更改线程优先级的结果。创建两个线程,其中一个线程的优先级设置为 BelowNormal。两个线程在 while 循环中都增加一个变量,并运行一段设定的时间。
Option Explicit
Option Strict
Imports System
Imports System.Threading
Public Class Test
MTAThread _
Shared Sub Main()
Dim priorityTest As New PriorityTest()
Dim threadOne As Thread = _
New Thread(AddressOf priorityTest.ThreadMethod)
threadOne.Name = "ThreadOne"
Dim threadTwo As Thread = _
New Thread(AddressOf priorityTest.ThreadMethod)
threadTwo.Name = "ThreadTwo"
threadTwo.Priority = ThreadPriority.BelowNormal
threadOne.Start()
threadTwo.Start()
' Allow counting for 10 seconds.
Thread.Sleep(10000)
priorityTest.LoopSwitch = False
End Sub
End Class
Public Class PriorityTest
Dim loopSwitchValue As Boolean
Sub New()
loopSwitchValue = True
End Sub
WriteOnly Property LoopSwitch As Boolean
Set
loopSwitchValue = Value
End Set
End Property
Sub ThreadMethod()
Dim threadCount As Long = 0
While loopSwitchValue
threadCount += 1
End While
Console.WriteLine("{0} with {1,11} priority " _
"has a count = {2,13}", Thread.CurrentThread.Name, _
Thread.CurrentThread.Priority.ToString(), _
threadCount.ToString("N0"))
End Sub
End Class
Sub Main()
Dim thr As Thread
For Pi As Integer=0 To 4 //启用5线程
MulParams =Pi vbTab sFile vbTab dFile vbTab 1 vbTab DelN vbTab cr vbTab cg vbTab cb vbTab IndexI
GlobalParamas(pi)=MulParams .Split(vbTab)
thr=New Thread(AddressOf MyMulThreadCaller)
thr.Start() //启动多线程进程
Application.DoEvents
Next
End Sub