开发者

.NET Detecting Thread exits from external code?

开发者_运维问答

I'm building a library in which to be consumed by a multi-threaded application. And I need a way to determine whether a particular thread is exiting.

Is there a way to add hooks or be notified when a certain Thread exits if you don't directly owns the thread?

Thread aborts are exceptional and thus I don't care about aborts, only proper exits.

This will greatly simplify the library if it is possible.

Any ideas?


You could start a separate thread of your own and Join() it to the thread in question.

However, I don't see any simpler way to get an Exited event.
(Polling IsAlive is rarely a good option)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜