🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Thread problem.

#13648
From: Charles Page
Date: Thu, 02 Oct 2003 00:28
53 lines
2512 bytes
if you have a thread that all it does is execute a function, and it is 
competing with another thread with does more (your VCL thread), and they 
have the same priority, yeah, things are going to go slowly in that 
other thread (the VCL in your case).  When you have a timer happening, 
there is a delay between renderings, during which the computers sources 
are free.  You either need to use a timer, render in a frames per second 
scheme in the thread or turn the priority down.  Turning the priority 
down may not really work.

charlie

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: <3f7b7121$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-08!supernews.com!small1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <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-01 17:39:14 PST
Date: Wed, 01 Oct 2003 20:28:28 -0400
From: Charles Page <lissom@snet.net>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5b) Gecko/20030901 Thunderbird/0.2
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=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 69.0.81.217
Message-ID: <3f7b7121$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1065054497 69.0.81.217 (1 Oct 2003 17:28:17 -0700)
Lines: 54
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-08!supernews.com!small1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail