gambas-source-code/app/examples/Misc/Multiprocessing/.src/CalcPrimesTask.class
Martin Fischer 3180d51c8f Adds Multiprocessing example project
[EXAMPLES]
* NEW: misc/Multiprocessing
2023-09-02 20:01:29 +02:00

17 lines
458 B
Text

' 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