Article View: borland.public.cppbuilder.nativeapi
Article #6375Re: threads memory access
From: Remy Lebeau (TeamB)
Date: Fri, 20 May 2005 21:58
Date: Fri, 20 May 2005 21:58
21 lines
1901 bytes
1901 bytes
"Jonathan Benedicto" <incorrect@no.server> wrote in message news:428e4b3f$1@newsgroups.borland.com... > Now, when they need a buffer, they just loop through the vector, > finding one with its Locked == false, and then set the Locked to > true, fill the char* and int, and then send a pointer to it to the 3rd > thread. Once the 3rd thread is finished with it, it just sets the > Locked to false. > > Would it cause a problem if the 1st and 3rd, or the 2nd and 3rd, > did read / write to Locked at the same time ? As long as the 3rd thread never deals with unlocked structures, and the 1st and 2nd threads never access each other's structures but only their own, and the 1st and 2nd threads never do anything with the locked structures (not even free them until they are unlocked by the 3rd thread), then the design you have described will work fine. Gambit
Technical Details
Message-ID:
<428e5d74$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<428e4b3f$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,f662da50ec5f6f69 X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <428e4b3f$1@newsgroups.borland.com> Subject: Re: threads memory access Date: Fri, 20 May 2005 14:58:14 -0700 Lines: 23 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 68.69.17.41 Message-ID: <428e5d74$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1116626292 68.69.17.41 (20 May 2005 14:58:12 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail