🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Killing off a crashed thread

#12371
From: Rodolfo Frino
Date: Thu, 04 Dec 2003 22:09
28 lines
2103 bytes
What about the Win32 API's ExitThread(). (and CloseHandle() to ensure
the that the thread object is removed from the operating system.)

Rodolfo

"Remy Lebeau (TeamB)" <gambit47.no.spam@no.spam.yahoo.com> wrote in message
news:3fcf7af5$1@newsgroups.borland.com...
>
> "bladder" <bladder@lardyboys.com> wrote in message
> news:3fcf0500$1@newsgroups.borland.com...
>
> > What I'd like to know is the recommended way that a thread
> > can terminate another thread( even if the thread is running ) and
> > what cleaning up the terminating thread should perform?
>
> Assuming that you are using TThread, the safest way is to just call the
> thread's Terminate() method and then have the thread check its Terminated
> property periodically so that it can return from its Execute() method
> gracefully.  Or if the thread has a message queue, post a WM_QUIT message
> via PostThreadMessage() so that the queue is exited and Execute() can
> return.  Otherwise, the only other way is via the Win32 API
> TerminateThread() function, however that is a brute-force termination that
> won't allow the thread to do any kind of cleanup at all.
>
>
> Gambit
>
>
Technical Details
Message-ID: <3fcfb097@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3fcf0500$1@newsgroups.borland.com> <3fcf7af5$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,f3d1051f853af8a9
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-12-04 14:10:25 PST
From: "Rodolfo Frino" <MenInBlack@nowhere.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3fcf0500$1@newsgroups.borland.com> <3fcf7af5$1@newsgroups.borland.com>
Subject: Re: Killing off a crashed thread
Date: Fri, 5 Dec 2003 09:09:45 +1100
Lines: 30
Organization: Men In Black
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: 203.206.16.193
Message-ID: <3fcfb097@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1070575767 203.206.16.193 (4 Dec 2003 14:09:27 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail