🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Thread problem.

#13557
From: Bob Gonder
Date: Thu, 02 Oct 2003 15:52
22 lines
1815 bytes
>Bogdan wrote:

>> I have a function that renders a Direct3D scene.If I call this function
>> periodically through a timer everything works ok.But if I put the same
>> function in a thread the application stops responding, or responds with
>> a lot of delay, to its own messages(mouse clicks, movement).

I wonder if a message pump inside your rendering would perk up the UI:

void _stdcall myYield(void)
{   MSG msg;
     while( PeekMessage(&msg,ghWnd,0,0,PM_REMOVE) )
     {	TranslateMessage(&msg);
	DispatchMessage(&msg);
     };
}
Where ghWnd is the HWND of the UI thread.
Sprinkle myYield() through your Render() code.
Probably not in a tight inner loop, but in an outer loop, or after a
lot of calculating.

This seems to help in my (non-vcl) code.
Technical Details
Message-ID: <0rhonv4kv04h9fmui4587jsvii4ket2crp@4ax.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3f7b216f@newsgroups.borland.com> <3f7b7121$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,41aab54595cffc86
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-10-02 10:25:32 PST
From: Bob Gonder <notbg@notmindspring.invalid>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Thread problem.
Date: Thu, 02 Oct 2003 08:52:19 -0700
Organization: MindSpring Enterprises, Inc.
Reply-To: notbg@notmindspring.invalid
Message-ID: <0rhonv4kv04h9fmui4587jsvii4ket2crp@4ax.com>
References: <3f7b216f@newsgroups.borland.com> <3f7b7121$1@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.91/32.564
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 67.31.165.231
X-Trace: newsgroups.borland.com 1065109944 67.31.165.231 (2 Oct 2003 08:52:24 -0700)
Lines: 23
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail