Article View: borland.public.cppbuilder.nativeapi
Article #2769TCriticalSection between 2 threads
From: Tumurbaatar S.
Date: Tue, 28 Nov 2006 09:03
Date: Tue, 28 Nov 2006 09:03
9 lines
1297 bytes
1297 bytes
To communicate and pass data (several integers and AnsiString's) between 2 threads, I use TCriticalSection object. The first thread only writes/modifies the protected section and the second one only reads. Of course, read/write operations are executed within TCriticalSection's Enter/Leave(). My question: do I need to use Enter/Leave() if the writing thread (the 1st one) needs to _read_ data that it modified?
Technical Details
Message-ID:
<456bfb16@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,2ab3d3cded5b6fe1,start X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Tumurbaatar S." <spam_tumur@magicnet.mn> Newsgroups: borland.public.cppbuilder.nativeapi Subject: TCriticalSection between 2 threads Date: Tue, 28 Nov 2006 17:03:05 +0800 Lines: 11 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2869 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962 NNTP-Posting-Host: 202.131.2.4 Message-ID: <456bfb16@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1164704534 202.131.2.4 (28 Nov 2006 01:02:14 -0700) Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail