Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get to the parent thread from a child thread or another thread? [duplicate]

Possible Duplicate:
.NET Is there a way to get the parent thread id?

Is there any relationship between threads in .NET? I urgently need to get the parent thread from the actual thread and there is no way to handover this piece of information. Is there any way to get parent thread in .NET or using the Win32 API?

Is there any way to get parent thread from any other thread?

like image 778
Martin Macak Avatar asked Feb 28 '11 13:02

Martin Macak


1 Answers

.NET does not record parent-child relationships between threads. You will need to track this data on your own, by passing the parent thread to the child on creation.

That said, I cannot possibly imagine why you would need this. Isn't Joining from the parent or something good enough?

I can understand that you might be frustrated by questions like "What are you trying to do, anyway?" - but often times if you let us know what your true goal is we may be able to find a better way that you didn't think of. :)

like image 176
bdonlan Avatar answered Sep 19 '22 14:09

bdonlan