Reputation: 2051
Are there any new parallel programing features in Delphi 2006 - XE?
Upvotes: 3
Views: 1152
Reputation: 26361
Since 2010 or XE threads can be named, though this is only visible in the debugger (not in e.g. sysinternals stuff like procesxp)
Upvotes: 1
Reputation: 27493
IMO the most powerful and the least known multithreading feature introduced after Delphi 7 is TThread.Queue method. For example, instead of
Synchronize(
procedure
begin
Form1.Memo1.Lines.Add(‘Begin Execution’);
end);
you can use
Queue(
procedure
begin
Form1.Memo1.Lines.Add(‘Begin Execution’);
end);
TThread.Queue is an alternative to TThread.Synchronize that allows a worker thread to continue without waiting (with Synchronize call a worker thread waits until the main thread finished execution of the synchronized code) - a really nice feature that can be used as a replacement for custom message processing with PostMessage.
Upvotes: 4
Reputation: 26850
There's a TThread.CreateAnonymousThread in Delphi XE which allows for simple execution of background tasks.
A trivial demo:
TThread.CreateAnonymousThread(
procedure begin
Sleep(10000); // replace with a real workload
end
).Start;
Upvotes: 4
Reputation: 1007
Currently no multicores cpu even if there are codes to run in multithreads. lock and unlock issue here is why
Cheer
Upvotes: 0
Reputation: 84650
Minimal in the releases themselves. In Delphi 2009 they added support for anonymous methods in TThread.Synchronize
, and in XE they added a thread-communication queue to Generics.Collections
.
But the community has contributed some interesting stuff. For example, check out OmniThreadLibrary.
Upvotes: 7