🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #2316

Re: VC++ CSemaphore equivalent?

#2316
From: Jonathan Benedicto
Date: Mon, 12 Mar 2007 18:16
42 lines
2485 bytes
Robert G. Hoover wrote:
> 'busy' is unused throughout the rest of the application during execution. 
> When
> the user closes the main window, I set 'terminated' to true and wait until
> '!grabbing'  Sorry for the confusion. I appended the total thread loop 
> below.
> 'busy' is unused. Again, included for future use, not implemented in any 
> other
> part of the program.

Ok.


> 'grab()' calls my camera supplier's video GrabSingleFrame() call which I 
> have
> been assured but cannot validate is thread-safe.

Ok.


> 'process()' does nothing unless check marks are set in additional GUI 
> window. No
> functions are called from this routine as no checkmarks are checked.
> ex. if (VideoForm->BlurImage->Checked) BlurVideoImage();

That does not sound like that function is thread-safe. I'd use a couple 
bools to store the state of the checkboxes, and then check the bools in the 
thread, instead of checking the actual checkboxes.


> 'display()' calls SendDIBitsToDevice()

Where do you get the device handle to pass to SendDIBitsToDevice?


> Really, these threads should run independent of each other (I hope).

Yes they do, however, they access data that is used by both threads, and if 
the access is not written in a thread-safe manner, it will not work 
properly.

Jon 
Technical Details
Message-ID: <45f598bf$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.maxwell.syr.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <45f57403@newsgroups.borland.com> <45f59433$1@newsgroups.borland.com> <45f5973e$1@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
From: "Jonathan Benedicto" <invalid@nobody.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <45f57403@newsgroups.borland.com> <45f59433$1@newsgroups.borland.com> <45f5973e$1@newsgroups.borland.com>
In-Reply-To: <45f5973e$1@newsgroups.borland.com>
Subject: Re: VC++ CSemaphore equivalent?
Date: Mon, 12 Mar 2007 14:16:01 -0400
Lines: 43
MIME-Version: 1.0
Content-Type: text/plain;
 format=flowed;
 charset="iso-8859-1";
 reply-type=original
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Windows Mail 6.0.6000.16386
X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6000.16386
NNTP-Posting-Host: 74.115.18.89
Message-ID: <45f598bf$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1173723327 74.115.18.89 (12 Mar 2007 11:15:27 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.maxwell.syr.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail