Article View: borland.public.cppbuilder.nativeapi
Article #6252Re: threads memory access
From: bogon
Date: Mon, 30 May 2005 18:30
Date: Mon, 30 May 2005 18:30
34 lines
2733 bytes
2733 bytes
Jonathan Benedicto wrote: > "Dennis Jones" <nospam@nospam.com> wrote in message > news:429354a6@newsgroups.borland.com... > >>A critical section is the most efficient (in terms of performance) >>kernel >>mode synchronization primitive. If you are looking for performance, >>a >>critical section is the way to go. Though it might seem slower >>than, say, a >>boolean lock, it is safe, while a boolean lock is not. >> >>On the other hand, depending on what the other threads are doing, it >>might >>be faster to lock the whole vector, do your search, and then unlock >>(as >>opposed to locking each element individually). > > Thank you for this input. I'm going to try a critical section, and see > how it works out. Jonathan : To reduce the size and amount of time spent within the Critical Section, you might consider using a Critical Section to manage only the 'Boolean lock' access then you can be certain of the 'lock' status ie. <CS begin>test or transition boolean/<CS end>. It also means only the entry you're working on is restricted (by the CS) rather than the entire vector. ----------> signature = 6 lines follows <-------------- Neil Duffee, Joe SysProg, U d'Ottawa, Ottawa, Ont, Canada telephone:1 613 562 5800 x4585 fax:1 613 562 5161 mailto:NDuffee of uOttawa.ca http:/ /aix1.uottawa.ca/ ~nduffee "How *do* you plan for something like that?" Guardian Bob, Reboot "For every action, there is an equal and opposite criticism." "Systems Programming: Guilty, until proven innocent" John Norgauer 2004
Technical Details
Message-ID:
<429b5bdb$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<428e4b3f$1@newsgroups.borland.com> <4291c5b1$1@newsgroups.borland.com> <4291ed05$1@newsgroups.borland.com> <429354a6@newsgroups.borland.com> <429356ac$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 Date: Mon, 30 May 2005 14:30:52 -0400 From: bogon <foo@bar> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-ca, fr-ca MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: threads memory access References: <428e4b3f$1@newsgroups.borland.com> <4291c5b1$1@newsgroups.borland.com> <4291ed05$1@newsgroups.borland.com> <429354a6@newsgroups.borland.com> <429356ac$1@newsgroups.borland.com> In-Reply-To: <429356ac$1@newsgroups.borland.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 137.122.170.33 Message-ID: <429b5bdb$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1117477851 137.122.170.33 (30 May 2005 11:30:51 -0700) Lines: 35 Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail