开发者

Finding & terminating threads to shutdown application

I need to terminate the running threads to shutdown a开发者_开发技巧pplication.

After executing common application exit commands, there are a few threads are still running, so application won't shut down completely (console window is still open).

I use code snippets which create those threads, so I can't control these threads. To kill them I need to modify the code and make a running threads collection like thing (long way) or get the -still- running threads and terminate them gracefully.

Now, how can I get the alive threads list in C#?


while creating threads, you can set thread.IsBackground = true which terminates process event when they are not "finished" (when all non-background threads are).

more: http://msdn.microsoft.com/en-us/library/system.threading.thread.isbackground.aspx

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜