🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Thread

#14093
From: Saravanan
Date: Tue, 26 Aug 2003 20:16
68 lines
3080 bytes
For initial level, this holds good.  Properities can change in run-time based on the user input.  And also there is so many properities to be set...

I have completely coded as if the control gets created in Primary Thread...Because of this sugglish i have been forced to spawn a new thread...So i need minimal level of changes...

Saravanan A

"Remy Lebeau \(TeamB\)" <gambit47@yahoo.com> wrote:
>
>"saravanan" <Saravanan@opussoft.com> wrote in message
>news:3f4b8d2f$1@newsgroups.borland.com...
>> My problem is how can i ensure that XControl has been created
>> before executing the below mentioned line :
><snip>
>
>The simpliest approach would be to pass the desired values as parameters to
>the thread's constructor, store them into private variables, and then let
>the Execute() assign the properties after it creates the object.  Then the
>main thread doesn't have to worry about waiting at all.
>
>For example:
>
>    class TServiceThread : public TThread
>    {
>    private:
>        TColor FBackground, FForeground;
>        TXControl *XControl;
>    protected:
>        void __fastcall Execute();
>    public:
>        __fastcall TServiceThread(TColor Background, TColor Foreground);
>    };
>
>    __fastcall TServiceThread::TServiceThread(TColor Background, TColor
>Foreground)
>        : TThread(true)
>    {
>        FreeOnTerminate = true;
>        FBackground = Background;
>        FForeground = Foreground;
>        Resume();
>    }
>
>    void __fastcall TServiceThread::Execute()
>    {
>        XControl = new TXControl(NULL) ;
>        XControl->BackgroundColor = FBackground;
>        XControl->ForegroundColor = FForeground;
>        XControl->ProcessMessage() ;
>        delete XControl;
>    }
>
>Then the main thread simply has to create the thread and let it do its thing
>on its own:
>
>    new TServiceThread(mBackground, mForeground);
>
>
>Gambit
>
>
>
>---
>Outgoing mail is certified Virus Free.
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.512 / Virus Database: 309 - Release Date: 8/19/03
>
>
Technical Details
Message-ID: <3f4bc01f$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!priapus.visi.com!news-out.visi.com!petbe.visi.com!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3f4b8d2f$1@newsgroups.borland.com> <3f4baea7$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,d3c99904b7c174bd
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-08-26 13:21:28 PST
From: "Saravanan" <saravanan@opussoft.com>
Sender: "Saravanan" <saravanan@opussoft.com>
Reply-To: "Saravanan" <saravanan@opussoft.com>
Subject: Re: Thread
Newsgroups: borland.public.cppbuilder.nativeapi
X-User-Info: 61.1.200.115 61.1.200.115    
References: <3f4b8d2f$1@newsgroups.borland.com> <3f4baea7$1@newsgroups.borland.com>
NNTP-Posting-Host: 207.105.83.65
Message-ID: <3f4bc01f$1@newsgroups.borland.com>
Date: 26 Aug 2003 13:16:31 -0700
X-Trace: newsgroups.borland.com 1061928991 207.105.83.65 (26 Aug 2003 13:16:31 -0700)
Lines: 69
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!priapus.visi.com!news-out.visi.com!petbe.visi.com!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail