Article View: borland.public.cppbuilder.nativeapi
Article #2306VC++ CSemaphore equivalent?
From: Robert G. Hoover
Date: Mon, 12 Mar 2007 15:39
Date: Mon, 12 Mar 2007 15:39
48 lines
2750 bytes
2750 bytes
Hi,
I've written a video streaming application in Borland C++ Builder v5,6,2006 that
is experiencing a drastic performance decline on the new Intel D 935 (dual core)
processor. My camera supplier recommended using the Micro$oft CSemaphore classes
which is impractical as I use Borland products exclusively to develop my code.
Is there a Borland equivalent? Can I use the CreateSemaphore(), OpenSemaphore(),
ReleaseSemaphore() to keep my video grab/display thread from hiccuping so badly?
For reference, I have appended my thread code which uses simple bool variables.
If I utilize this Sleep() command at the bottom of the loop, performance is
improved, though not like it was on older machines. My 4-year-old laptop is
outperforming my tricked-out desktop!!! Any advice is welcome!
Thanks so much!
Rob
_________________________________________________________________________________
// grab, process, display live video as normal
while (!terminated)
{
// give primary thread time to process frozen image
if (frozen)
Sleep(100);
// grab, process, and display video data
else
{
// set semiphore
busy = true;
// grab video frame(s) from camera
Grab(live_grabbing_count);
// process image data
Process();
// display current image on screen
Display();
// clear semiphore
busy = false;
// preserve process time
// Sleep(FrameRateTimeOut);
}
}
Technical Details
Message-ID:
<45f57403@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!newsfeed.freenet.de!news.albasani.net!feeder06.uucp-net.de!reader.uucp.at!newsfeed.uucp.at!news.uucp.at!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,411b13b57e2ea81a,start X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Mon, 12 Mar 2007 11:39:23 -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: VC++ CSemaphore equivalent? X-Enigmail-Version: 0.94.1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Antivirus: avast! (VPS 000723-0, 03/11/2007), Outbound message X-Antivirus-Status: Not-Tested NNTP-Posting-Host: 68.48.157.44 Message-ID: <45f57403@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1173713923 68.48.157.44 (12 Mar 2007 08:38:43 -0800) Lines: 48 Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!newsfeed.freenet.de!news.albasani.net!feeder06.uucp-net.de!reader.uucp.at!newsfeed.uucp.at!news.uucp.at!newsgroups.borland.com!not-for-mail