Board index » delphi » TThread vs. CreateThread

TThread vs. CreateThread

Hi.

I don't know if this question has been addressed in this newsgroups, but I
have been using the Win32 API to synchronized threads for quite awhile, even
with the VCL.  A friend suggested that I try using TThread...

I am looking for opinions for either scenario, specifically, pros and cons
to either method.

Is one more efficient that the other?

Thanks..

Michael Koon

 

Re:TThread vs. CreateThread


As a general rule, if a language offers threading constructs you should probably
use them since there may be some per-thread runtime initialization involved.  As
far as TThread specifically, the choice isn't related to efficiency but
convenience.  I doubt the performance difference, if any, would be noticable.

-Jim Green

Quote
Michael Koon wrote:
> Hi.

> I don't know if this question has been addressed in this newsgroups, but I
> have been using the Win32 API to synchronized threads for quite awhile, even
> with the VCL.  A friend suggested that I try using TThread...

> I am looking for opinions for either scenario, specifically, pros and cons
> to either method.

> Is one more efficient that the other?

> Thanks..

> Michael Koon

Re:TThread vs. CreateThread


: "Michael Koon" <Michael_K...@sfmny.com> wrote:

Quote
>Hi.

>I don't know if this question has been addressed in this newsgroups, but I
>have been using the Win32 API to synchronized threads for quite awhile, even
>with the VCL.  A friend suggested that I try using TThread...

>I am looking for opinions for either scenario, specifically, pros and cons
>to either method.

>Is one more efficient that the other?

No.

Actually TThread is nothing but a (convenience) wrapper around
BeginThread, EndThread, et.al.

Perhaps TThread is more efficient to _use_, but at runtime, they
behave the same.

--
Stefan.Hoffmeister (at) Uni-Passau.de
http://kakadu.rz.uni-passau.de/~w4hoff01/Delphi
   DIR: Delphi FAQs, KBs, docs

Private email regarding Delphi will usually be ignored
unless it has been expressedly invited.

Re:TThread vs. CreateThread


On Tue, 25 Aug 1998 07:39:08 GMT, no.s...@address.in.signature (Stefan

Quote
Hoffmeister) wrote:
>: "Michael Koon" <Michael_K...@sfmny.com> wrote:

>>Hi.

>>I don't know if this question has been addressed in this newsgroups, but I
>>have been using the Win32 API to synchronized threads for quite awhile, even
>>with the VCL.  A friend suggested that I try using TThread...

>>I am looking for opinions for either scenario, specifically, pros and cons
>>to either method.

>>Is one more efficient that the other?

>No.

>Actually TThread is nothing but a (convenience) wrapper around
>BeginThread, EndThread, et.al.

>Perhaps TThread is more efficient to _use_, but at runtime, they
>behave the same.

There is, though, an important reason to use either TThread or
BeginThread rather than the Win32 API.  If you don't, the RTL won't know
that your program is multithreaded, and won't use critical sections to
serialize memory manager calls.

--
Report all {*word*201} mail to your Potsmaster.

Re:TThread vs. CreateThread


On 25 Aug 1998 15:03:44 GMT, drifk...@acm.deleteme.org (David Rifkind)
wrote:

Quote
>There is, though, an important reason to use either TThread or
>BeginThread rather than the Win32 API.  If you don't, the RTL won't know
>that your program is multithreaded, and won't use critical sections to
>serialize memory manager calls.

If you really want to use the raw Windows API, you can explicitly set
IsMultiThread to True.
--
Ray Lischner (http://www.tempest-sw.com/)
Author of "Hidden Paths of Delphi 3: Experts, Wizards, and the Open Tools API"

Other Threads