Article View: borland.public.cppbuilder.nativeapi
Article #2309Re: VC++ CSemaphore equivalent?
From: Robert G. Hoover
Date: Mon, 12 Mar 2007 16:47
Date: Mon, 12 Mar 2007 16:47
41 lines
2928 bytes
2928 bytes
Hi Dennis, You know, I've been asking myself the same (#3) question. The 'busy' flag is not being tested in my main process at all until the point of termination. (Wait until !busy before terminating parent process) So, is my problem semaphore-related? Or rather processor related? I can't imagine implementing the Win32 Semaphore functions and seeing any different results. My Borland BDS 2006 (C++ Builder) is compiling my program the same way as always, before this new chip was introduced to the market. Is it possible that the compiler is not compiling optimally for this new chip? Can BDS be set to compile differently for this dual-core chip? Can I use 1 half of the processor for my main application thread and the 2nd half for my video thread so that they are executed in true parallel? This certainly seems to be a problem related to the processor itself as that's the only thing that has changed. I've been compiling in Borland for near 14 years, MANY different computers, processors, peripherals, etc, and never seen this kind of behavior... Thanks, Rob > > First, your code doesn't really give enough information to go on -- it > doesn't show where the 'busy' flag is being tested, and doesn't provide any > context to make sense of the problem you are having. You should probably > post a more complete example. > > Second, if a Semaphore is needed, you can of course use the Win32 Semaphore > functions (CSemaphore is merely a wrapper around those functions), or you > can write your own semaphore class/wrapper. > > Third, do you really need a semaphore? Semaphores are typically used for > resource counting. If you just need to synchronize access to data, a > critical section is simpler and faster. > > - Dennis > >
Technical Details
Message-ID:
<45f583fb$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<45f57403@newsgroups.borland.com> <45f57fd5@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,411b13b57e2ea81a X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Mon, 12 Mar 2007 12:47:32 -0400 From: "Robert G. Hoover" <not.a.real.address@anywhere.sorry> User-Agent: Thunderbird 1.5.0.10 (Windows/20070221) MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: VC++ CSemaphore equivalent? References: <45f57403@newsgroups.borland.com> <45f57fd5@newsgroups.borland.com> In-Reply-To: <45f57fd5@newsgroups.borland.com> X-Enigmail-Version: 0.94.1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Antivirus: avast! (VPS 000723-1, 03/12/2007), Outbound message X-Antivirus-Status: Not-Tested NNTP-Posting-Host: 68.48.157.44 Message-ID: <45f583fb$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1173718011 68.48.157.44 (12 Mar 2007 09:46:51 -0800) Lines: 41 Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail