Get parent Tid of a thread?
Simen Kjaeraas
simen.kjaras at gmail.com
Wed Jun 29 14:17:42 PDT 2011
On Wed, 29 Jun 2011 22:59:47 +0200, Andrej Mitrovic
<andrej.mitrovich at gmail.com> wrote:
> Is there any way a newly spawned thread can get the Tid of the thread
> that spawned it, basically its parent? I'd prefer that over using
> this:
>
> __gshared mainThread; // so workThread can access it
>
> {
> mainThread = thisTid();
> auto workThread = spawn(&MidiThread); // local
> }
std.concurrency actually has a thread-local variable called 'owner',
which is exactly what you want. However, it is private.
This may very well be worth an enhancement request.
--
Simen
More information about the Digitalmars-d-learn
mailing list