G
Guest
Hi,
I have a program need to check the value of a application available, and then decide whether to execute codes followed.
In order to achieve this purpose, I use DO WHILE loop to judge the value, if the value meet the condition clause, program will exit the loop. But this DO WHILE loop consumes too much CPU resource.
Now my question is whether a possible way to pause a process for a given time such as one minute?
Anyone can give me some guide on this issue? Thanks
For better understanding the scenario, please refer to following codes.
Public Function DataAccessBegin() As Boolean
Try
Dim StartTime As DateTime
StartTime = Now
Do While Application("ActiveConnections") + 1 > Application("PermitConnections")
'If StartTime.AddMinutes(1) < Now Then
Me.LblMessage1.Text = "Two当å‰æ•°æ®åº“访问用户太多,请ç¨åŽå†ä½¿ç”¨è¯¥æŠ¥è¡¨ï¼"
Me.LblMessage1.CssClass = "ERROR"
Return False
'End If
Loop
Application("ActiveConnections") = Application("ActiveConnections") + mDataRow(0).Item("FORBIDCONN")
If Application("ActiveConnections") > Application("PeakConnections") Then Application("PeakConnections") = Application("ActiveConnections")
End If
Finally
End Try
Return True
End Function
Lei Guangfu(雷光富)
I have a program need to check the value of a application available, and then decide whether to execute codes followed.
In order to achieve this purpose, I use DO WHILE loop to judge the value, if the value meet the condition clause, program will exit the loop. But this DO WHILE loop consumes too much CPU resource.
Now my question is whether a possible way to pause a process for a given time such as one minute?
Anyone can give me some guide on this issue? Thanks
For better understanding the scenario, please refer to following codes.
Public Function DataAccessBegin() As Boolean
Try
Dim StartTime As DateTime
StartTime = Now
Do While Application("ActiveConnections") + 1 > Application("PermitConnections")
'If StartTime.AddMinutes(1) < Now Then
Me.LblMessage1.Text = "Two当å‰æ•°æ®åº“访问用户太多,请ç¨åŽå†ä½¿ç”¨è¯¥æŠ¥è¡¨ï¼"
Me.LblMessage1.CssClass = "ERROR"
Return False
'End If
Loop
Application("ActiveConnections") = Application("ActiveConnections") + mDataRow(0).Item("FORBIDCONN")
If Application("ActiveConnections") > Application("PeakConnections") Then Application("PeakConnections") = Application("ActiveConnections")
End If
Finally
End Try
Return True
End Function
Lei Guangfu(雷光富)