Article View: comp.lang.pascal.delphi.misc
Article #363Re: THREADVARS & MUTEXs
From: Art Metz
Date: Fri, 03 Sep 1999 00:00
Date: Fri, 03 Sep 1999 00:00
35 lines
2255 bytes
2255 bytes
>Problem 1.... I am not sure when to use 'threadvars' as opposed to standard 'vars' in my thread code. If someone could explain the difference between the two, I would really appreciate it. < Essentially, threadvars are the native Win32 implementation of thread-specific variables. They are a limited resource. To conserve resources, Delphi wraps all the member fields (variables) of your thread into a single threadvar. You should never need a threadvar. >Problem 2.... I need to ensure exclusive access to a common datastructure from the multiple thread instances. Do you know of any neat ways to do this in Delphi. The only thing I can find in the Borland Docs is the Synchronise() function. Is this the way to go ? < No, use critical sections or mutexes instead. >I am using Delphi 2 btw. < Umm, why? D3 added packages (so you no longer need to rebuild complib), divorced the BDE from TDataSet (leading to the 3rd-party database market), etc. D4 added function overloading and better support for COM/ActiveX. D5 is shipping now. D2 was great, 3 years ago. Time to move on. --- Art * Sent from RemarQ http://www.remarq.com The Internet's Discussion Network * The fastest and easiest way to search and participate in Usenet - Free!
Technical Details
Message-ID:
<11f733ec.558f0479@usw-ex0107-056.remarq.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<r0Kz3.357$dh4.11970@news2-hme0>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f973d,646be05df1791793 X-Google-Attributes: gidf973d,public X-Google-Thread: 10baee,646be05df1791793 X-Google-Attributes: gid10baee,public X-Google-Thread: 1043cf,646be05df1791793 X-Google-Attributes: gid1043cf,public From: Art Metz <ametz@navco.com> Subject: Re: THREADVARS & MUTEXs Date: 1999/09/03 Message-ID: <11f733ec.558f0479@usw-ex0107-056.remarq.com> X-Deja-AN: 520721844 References: <r0Kz3.357$dh4.11970@news2-hme0> Bytes: 1298 X-Originating-Host: 216.112.222.194 X-Complaints-To: wrenabuse@remarq.com X-Trace: WReNphoon3 936384237 10.0.2.56 (Fri, 03 Sep 1999 11:43:57 PDT) Organization: http://www.remarq.com: The World's Usenet/Discussions Start Here NNTP-Posting-Date: Fri, 03 Sep 1999 11:43:57 PDT Newsgroups: comp.lang.pascal.delphi.misc,alt.lang.delphi,borland.public.delphi.objectpascal X-Wren-Trace: eH9acnNqLWcsPmZybiVeeGx6bHU0eDBkOiEhKjg6N20+K20sP24zJQ==