🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Multi-Thread HDC and Video Display

#1995
From: Bob Gonder
Date: Fri, 25 May 2007 17:27
34 lines
2099 bytes
Robert G. Hoover wrote:

>	// give primary thread time to process frozen image
>	if (frozen)
>		Sleep(100);

What's the frame rate supposed to be?
A tenth of a second or more (Sleep is a minimum) seems like entirely
too long, especially in a low priority thread.
Sleep(0) should be adequate, but every frame might be better..

>	// grab, process, and display video data

This is the part that could use multi processors if this were 3
threads instead of one.
Setup a minimum of 3 buffers.
(Approximate timeline)
			GrabBuffer( 1 )
			GrabBuffer( 2 )
Wait for GrabBuffer( 1 ) then	Process( 1 )
			GrabBuffer( 3 )
Wait for GrabBuffer( 2 ) then	Process( 2 )
Wait for Process( 1 ) then	Display( 1 )
Wait for Display( 1 ) then	GrabBuffer( 1 )

I think I'd use events for the WaitFor
And a Sleep(0) each iteration in all three threads.

>problem? Perhaps if I configure my entire program to use a single side of the
>processor then it will behave like it does on single-core machines? Can I do that?

GetProcessAffinityMask
	reduce the mask to a single "on" bit then
SetProcessAffinityMask
Technical Details
Message-ID: <h54e53hfjr52i0shie1fahu583o52sglv9@4ax.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <45f57403@newsgroups.borland.com> <4655cb92@newsgroups.borland.com> <4656d0f8@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,411b13b57e2ea81a
X-Google-Attributes: gid10cc67,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: Bob Gonder <notbg@notmindspring.invalid>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Multi-Thread HDC and Video Display
Date: Fri, 25 May 2007 10:27:07 -0700
Organization: MindSpring Enterprises, Inc.
Reply-To: notbg@notmindspring.invalid
Message-ID: <h54e53hfjr52i0shie1fahu583o52sglv9@4ax.com>
References: <45f57403@newsgroups.borland.com> <4655cb92@newsgroups.borland.com> <4656d0f8@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.93/32.576 English (American)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 67.77.147.10
X-Trace: newsgroups.borland.com 1180114024 67.77.147.10 (25 May 2007 10:27:04 -0700)
Lines: 38
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail