🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: GetParentThread?

#16066
From: Ted Lyngmo
Date: Mon, 02 Jun 2003 16:49
25 lines
1726 bytes
Tharun Pillay wrote:
 > Anyone know how to get the calling thread eg:
 >
 >
 > Thread 1
 >     Thread1_1
 >         Thread1_1_1
 >         Thread1_1_2
 >
 >
 > How do I get the parent thread from inside Thread1_1_1?

You can't, since threads do not have the kind of parent/child relationship you 
describe while running. Even though one thread creates another, they all siblings.

You can however can pass GetCurrentThreadId(), or a DuplicateHandle() of 
GetCurrentThread(), to the threads you create using the 'lpParameter' of 
CreateThread().

Kind regards,
Ted Lyngmo

-- 
Replace MY_FIRST_NAME in my email address with my first name to send a private
email to me.
Technical Details
Message-ID: <3EDB7FFD.7080505@lyncon.se>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news-out.visi.com!petbe.visi.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail
References: <3edb2f4a@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,51acd4b89590e
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-06-02 09:52:10 PST
Message-ID: <3EDB7FFD.7080505@lyncon.se>
Date: Mon, 02 Jun 2003 18:49:01 +0200
From: Ted Lyngmo <MY_FIRST_NAME@lyncon.se>
Organization: Lyncon - Computer & Music consulting
User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:0.9.4) Gecko/20011128 Netscape6/6.2.1
X-Accept-Language: sv,en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: GetParentThread?
References: <3edb2f4a@newsgroups.borland.com>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 217.215.147.98
X-Trace: newsgroups.borland.com 1054572160 217.215.147.98 (2 Jun 2003 09:42:40 -0700)
Lines: 26
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!news-out.visi.com!petbe.visi.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail