Thread Detach / Joinable Methods
Asked Answered
E

1

8

Where are the C# Thread Detach / Joinable functions?

In C++ 11 these functions are available:

thread::joinable()
thread::detach()

But they can't be found in .NET - where are they?

Eastman answered 7/9, 2014 at 14:11 Comment(1)
I don't believe there are 1:1 equivalents, as you've found. You may want to check #6895135Yorgo
E
2

What would detach do in your mind in .NET? .NET has no automatic storage duration. This concept does not apply.

joinable doesn't really apply either because you can Join any thread, even Thread.Current. If you insist on C++ semantics:

Thread someThread = ...;
bool isJoinable = Thread.Current != someThread;

Thread objects are subject to Garbage Collection but a thread runs to completion regardless of whether the Thread object is still reachable. Don't worry about this.

Executrix answered 7/9, 2014 at 20:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.