🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.pascal.delphi.misc
Article #485

Re: Thread safe classes. Advice required.

#485
From: Bj�rge S�ther
Date: Fri, 21 Apr 2000 00:00
42 lines
2656 bytes
"Martin Harvey" <martin@pergolesi.demon.co.uk> skrev i melding
news:39009953.2D1D2901@pergolesi.demon.co.uk...
> Here comes my problem. I'm currently developing with Delphi 4 standard,
> and hence I don't have the source (or even the help) on some of these
> objects!
>
> The list and the critical section are no problem, my tutorial has
> already discussed all the quirks involved with them.
>
> The multiple read fancy synchroniser is also trivial. I have the help
> files for this, and although I don't have the source, this particular
> synchronisation mechanism is such a classic textbook case, that I will
> have no problem explaining its internal workings without the source.

Hi !
The classes found in syncobjs unit;

 TCriticalSection,
 TSynchroObject,
 TEvent,
 TSimpleEvent;

are somewhat silly, if you ask me. The only thing they do, is adding more
lines to your code, and exchange WinAPI datatypes with Delphi classes. And -
the most impoortant: They obscure the reality of thread programming: You need
to understand the core of Windows OS somewhat better to succeed. I would
advice programmers to dive into the WinAPI instead.
The same may be said about TThread: The fact that this class exists, lead
programmers to believe that this is some basic pattern for threads. It took
me quite a while to understand that you would normally need to redesign the
TThread class both for startup, termination, execution *and* synchronization.
If they had provided a basic exception handling mechanism, it would be worth
something...I'm sure I would get there faster without the prewritten class,
at least.

Good luck with your book !

--
Bjoerge Saether
Consultant / Developer
Asker, Norway
bsaether.removethis@online.no (remove the obvious)
Technical Details
Message-ID: <6W3M4.8172$By1.151274@news1.online.no>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <39009953.2D1D2901@pergolesi.demon.co.uk>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb0ea,a11e9ce613315ab7
X-Google-Attributes: gidfb0ea,public
X-Google-Thread: 10baee,a11e9ce613315ab7
X-Google-Attributes: gid10baee,public
From: "Bj�rge S�ther" <REMOVE_bsaether@THIS_online.no>
Subject: Re: Thread safe classes. Advice required.
Date: 2000/04/21
Message-ID: <6W3M4.8172$By1.151274@news1.online.no>
X-Deja-AN: 614101628
References: <39009953.2D1D2901@pergolesi.demon.co.uk>
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600
X-Complaints-To: news-abuse@online.no
X-Trace: news1.online.no 956353282 130.67.14.182 (Fri, 21 Apr 2000 23:41:22 MET DST)
Organization: Telenor Online Public Access
X-MSMail-Priority: Normal
NNTP-Posting-Date: Fri, 21 Apr 2000 23:41:22 MET DST
Newsgroups: comp.lang.pascal.delphi.misc,borland.public.delphi.vcl.components.using