End

Now it would be nice to wrap the core method of the loop (and the final output of the total and time) into separate anonymous methods to be passes to a ParallelFor function:

procedure TFormParallelFor.btnParallel2Click(

Sender: TObject); var

Tot: Integer; Ticks: Cardinal; begi n

Ticks := GetTickCount; ParallelFor (1, Max, 2, procedure (i: Integer) begi n if IsPrime (I) then

Interlockedlncrement (Tot); end);

Ticks := GetTickCount - Ticks; Memo1.Lines.Add (Format (

Was this article helpful?

0 0
Project Management Made Easy

Project Management Made Easy

What you need to know about… Project Management Made Easy! Project management consists of more than just a large building project and can encompass small projects as well. No matter what the size of your project, you need to have some sort of project management. How you manage your project has everything to do with its outcome.

Get My Free Ebook


Post a comment