ProcessingState.lookingForPrime) Then
Throw New Exception( _
"Продолжается поиск простого числа! Окончательное время еще не вычислено")
End If
Return m_endTickCount - m_startTickCount
End Function
'------------------------
'Возвращает простое число
'------------------------
Public Function getPrime() As Long
If (getProcessingState() <> ProcessingState.foundPrime) Then
Throw New Exception("Простое число еще не найдено!")
End If
Return m_NextHighestPrime
End Function
'Конструктор класса
Public Sub New(ByVal startPoint As Long)
setProcessingState(ProcessingState.notYetStarted)
m_startPoint = startPoint
End Sub
'-----------------------------------------------------------
'Создает новый рабочий поток, который будет вызывать функцию
'findNextHighestPrime()
'-----------------------------------------------------------
Public Sub findNextHighestPrime_Async()
Dim threadStartAs System.Threading.ThreadStart
threadStart = _
New System.Threading.ThreadStart( _
AddressOf findNextHighestPrime)
Dim newThread As System.Threading.Thread