Synchronize doesn't work as expected, see Joshy's posting. Example:
[...]
Maybe it's not a question of MTProcs rather than threading itself, I don't know.
BTW: Please add a short sentence to the wiki how Synchronize can be used with MTProcs (per Item.Thread). I was looking for that a long time
Thanks for your work, Matthias!
Hello,
I had understand the explanation, MTProcs dispatcher runs in main thread, well, in fact, in the current thread, so when you run "DoParallel" the main thread is blocked and syncronize will not happend. Solution run the DoParallel inside a Execute of a TThread. Something like:
MyParallelThread=class(TThread)
...
procedure MyParallelThread.Execute;
begin
DoParallel(....)
end;
[......]
procedure Form1.Button1Click();
var
Worker: TMyParallelThread;
begin
Worker:=TMyParallelThread.Create(true,false,...); //Start paused
Worker.FreeOnTerminate:=true;
Worker.Resume;
end;
This way when synchronize should work.