Article View: borland.public.cppbuilder.nativeapi
Article #13524Re: Thread problem.
From: Jonathan Starr
Date: Wed, 08 Oct 2003 03:54
Date: Wed, 08 Oct 2003 03:54
50 lines
2183 bytes
2183 bytes
Does the rendering take a long time? When Synchronized, I think it is
monopolizing
the main thread, which handles the User Interface. So you would cut off
mouse events, etc.
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).The thread
>has TP_NORMAL priority, and the function is called using the Synchronize
>method.
>
>Here's some sample code:
>In the thread:
>
>void __fastcall TRenderThread::Execute()
>{
> while(!Terminated)
> {
> Synchronize(f);
> };
>};
>
>where f is:
>
>void __fastcall TRenderThread::f(void)
>{
> Render();
>};
>
>And, using a timer:
>
>void __fastcall TMainForm::TimerTimer(TObject *Sender)
>{
> Render();
>}
>
>Render is the function that renders the Direct3D scene.
>
>Bogdan.
>
>
>
>
>
>
>
>
Technical Details
Message-ID:
<3f838867$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!216.170.153.135.MISMATCH!tdsnet-transit!newspeer.tds.net!news-out1.nntp.be!propagator2-sterling!news-in-sterling.nuthinbutnews.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<3f7b216f@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-07 20:57:47 PST Date: Tue, 07 Oct 2003 23:54:09 -0400 From: Jonathan Starr <starr@belsoft.com> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: Thread problem. References: <3f7b216f@newsgroups.borland.com> In-Reply-To: <3f7b216f@newsgroups.borland.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 66.217.148.62 Message-ID: <3f838867$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1065584743 66.217.148.62 (7 Oct 2003 20:45:43 -0700) Lines: 51 Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!216.170.153.135.MISMATCH!tdsnet-transit!newspeer.tds.net!news-out1.nntp.be!propagator2-sterling!news-in-sterling.nuthinbutnews.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail