🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: How to name thread created with Win32 CreateThread?

#5296
From: Remy Lebeau (TeamB)
Date: Thu, 15 Sep 2005 07:02
32 lines
2130 bytes
"Randall Parker" <STOPtechiepundit@EVILfuturePOXpunditSPAM.com> wrote in
message news:43291590$1@newsgroups.borland.com...

> Well, suppose you use Win32 CreateThread? How do name such a thread?

The exact same way that you do with TThread.  At the beginning of the block
of code that you pass as the lpStartAddress parameter of CreateThread(), use
the exact same code to raise the exact same exception.  RaiseException() is
a Win32 API function, afterall.  Besides, TThread uses CreateThread()
internally, so obviously the approach works for any thread that is started
by CreateThread().

> I have some code that I must keep compatible with MSVC
> and BCB and need a way to name threads that is not VCL specific.

The code that the TThread wizard generates for naming a thread is *NOT*
VCL-based to begin with.  The RaiseException() approach is the exact same
thing that Microsoft uses as well.

> I've looked here:
<snip>
> and nothing looks appropriate.

You are looking in the wrong place.  Look here instead:

    Setting a Thread Name (Unmanaged)

http://msdn.microsoft.com/library/en-us/vsdebug/html/vxtsksettingthreadname.asp?frame=true


Gambit
Technical Details
Message-ID: <43291c86$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news1.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <43291590$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,a97544f166359288
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <43291590$1@newsgroups.borland.com>
Subject: Re: How to name thread created with Win32 CreateThread?
Date: Thu, 15 Sep 2005 00:02:42 -0700
Lines: 34
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 68.69.17.41
Message-ID: <43291c86$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1126767750 68.69.17.41 (15 Sep 2005 00:02:30 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news1.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail