Astronavigator
Astronavigator

Reputation: 2051

Are there any new parallel programing features in Delphi 2006 - XE?

Are there any new parallel programing features in Delphi 2006 - XE?

Upvotes: 3

Views: 1152

Answers (5)

Marco van de Voort
Marco van de Voort

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

kludg
kludg

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

gabr
gabr

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

APZ28
APZ28

Reputation: 1007

Currently no multicores cpu even if there are codes to run in multithreads. lock and unlock issue here is why

  1. memory manager. it is better than in the past
  2. string is reference count
  3. interface is reference count

Cheer

Upvotes: 0

Mason Wheeler
Mason Wheeler

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

Related Questions