rtl-ppl

Strange behaviour of TParallel.For default ThreadPool

*爱你&永不变心* 提交于 2019-11-30 11:59:13
问题 I am trying out the Parallel Programming features of Delphi XE7 Update 1. I created a simple TParallel.For loop that basically does some bogus operations to pass the time. I launched the program on a 36 vCPU at an AWS instance (c4.8xlarge) to try to see what the gain of Parallel Programming could be. When I first launch the program and execute the TParallel.For loop, I see a significant gain (although admitelly a lot less than I anticipated with 36 vCPUs): Parallel matches: 23077072 in 242ms

How can I use TTask.WaitForAny from the new threading library?

ε祈祈猫儿з 提交于 2019-11-30 04:32:06
问题 In an attempt to use the threading library in Delphi to calculate tasks in parallel and using TTask.WaitForAny() to get the first calculated result, an exception occationally stopped the execution. Call stack at the exception: First chance exception at $752D2F71. Exception class EMonitorLockException with message 'Object lock not owned'. Process Project1.exe (11248) :752d2f71 KERNELBASE.RaiseException + 0x48 System.TMonitor.CheckOwningThread System.ErrorAt(25,$408C70) System.Error

Strange behaviour of TParallel.For default ThreadPool

早过忘川 提交于 2019-11-30 01:53:23
I am trying out the Parallel Programming features of Delphi XE7 Update 1. I created a simple TParallel.For loop that basically does some bogus operations to pass the time. I launched the program on a 36 vCPU at an AWS instance (c4.8xlarge) to try to see what the gain of Parallel Programming could be. When I first launch the program and execute the TParallel.For loop, I see a significant gain (although admitelly a lot less than I anticipated with 36 vCPUs): Parallel matches: 23077072 in 242ms Single Threaded matches: 23077072 in 2314ms If I do not close the program and run the pass again on the