On Fri, 19 Apr 2013 00:39:03 +0100 John Lee <johnel...@gmail.com> wrote:
> Thanks - however, my attempt to modify the test program by adding the exec > as below so it works in 'parallel' with the main program doesn't work, so I > must have missed something. What does not work? > program Test; > {$mode objfpc}{$H+} > uses windows,classes, dos, crt, sysutils,MTProcs; > var j:longint; > > // a simple parallel procedure > procedure DoSomethingParallel(Index: PtrInt; Data: Pointer; Item: > TMultiThreadP♦ > var > i: Integer; > begin > writeln(Index); > if index=1 then > begin Index runs from 1..5. This is executed only in the first step. > //this compression, using arc (but it could be 7z takes 30 secs) > exec('c:\windows\system32\cmd','/c c:\utils\arc a -mx tmp > c:\live_sol\ans.dat'); > exit; > end; > for i:=1 to Index*1000000 do ; // do some work > end; > > begin > ProcThreadPool.DoParallel(@DoSomethingParallel,1,5,nil); // address, > startind♦ > //main prog eg capturing the xml > for j:=1 to 10 do > begin write(j,' '); sleep(10000); end; Do you see this output? > end. Mattias _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal