gambas-source-code/app/examples/Misc/Multiprocessing/.src/CalcPrimesTask.class

18 lines
458 B
Text
Raw Normal View History

' Gambas class file
''' This is a task implementation that runs in a new forked process when constructed
Inherits Task
Private maxPrime As Long
Public Procedure _new(a_maxPrime As Long)
maxPrime = a_maxPrime
Application.Priority = 5 ' make this process nicer
End
Public Function Main() As Variant
' Note that the result of a Task has to be serializable to be passed to the main process
Return Primes.calcPrimesUpTo(maxPrime).Count
End