🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: OnTerminate Problems in TThread

#11576
From: Remy Lebeau (TeamB)
Date: Thu, 05 Feb 2004 18:42
27 lines
1909 bytes
"BillT" <billtouch_no_spam@att.net> wrote in message
news:4021d3fe@newsgroups.borland.com...

> The second thread runs but when it finishes, it does not
> transfer control to its OnTerminate Routine.

Are you still inside the first thread's OnTerminate event handler at the
time?  Or in another event handler of the main thread?  OnTerminate uses
Synchronize() internally, thus the main thread needs to process new messages
periodically (or in the case of BCB6, call the CheckSynchronize() function)
in order for Synchronize() to work correctly.


> void __fastcall TForm1::PackageThreadDone(TObject * /*Sender*/)
> {
>    delete PackageLoad;
>    Loader1();
> }

Do not delete the thread while you are still inside its event handler.  If
you must auto-delete the thread when it terminated, then simply set its
FreeOnTerminate property to true when you create the thread instance
instead.  The thread will free itself after OnTerminate has returned.


Gambit
Technical Details
Message-ID: <40228cc5$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.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: <4021d3fe@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,25162141e75feeb5
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2004-02-05 10:40:28 PST
From: "Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <4021d3fe@newsgroups.borland.com>
Subject: Re: OnTerminate Problems in TThread
Date: Thu, 5 Feb 2004 10:42:03 -0800
Lines: 29
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 67.22.138.253
Message-ID: <40228cc5$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1076006085 67.22.138.253 (5 Feb 2004 10:34:45 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail