Thread.Abort的 [英] Thread.Abort

查看:71
本文介绍了Thread.Abort的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我写了一个应用程序服务器(一个远程处理单元),其中进程必须在非常罕见的情况下通过线程完成停止
。中止()。偶尔和

只有在一个Thread.Abort()之后,这个组件变得不稳定,抛出了一个类似于Windows的错误(访问冲突在0x00000002上),而不是框架

例外。组件及其所有子组件都是100%托管代码。

Thread.Abort()出了什么问题?


感谢任何提示。

Urs

Hi

I wrote an application server (a remoting sinlgeton), where processes must
be stopped in very rare cases, done thru a Thread.Abort(). Occasionally, and
only after a Thread.Abort(), this component becomes instabile, throwing a
Windows like error (access violation on 0x00000002), not an framework
exception. The component and all of its subcomponents are 100% managed code.
What could go wrong with Thread.Abort()?

Thanks for any hints.
Urs

推荐答案

Thread.Abort()是一种只应该调用以中止当前线程的方法,

在另一个线程上调用它的唯一有效理由是当你打算

无论如何卸载应用程序域时。

有很多东西可能出错当中止另一个线程时,

请搜索档案,这已经好几次讨论了

这个和其他NG'。


Willy。


" Urs Vogel" < UV **** @ msn.com>在消息中写道

新闻:%2 **************** @ TK2MSFTNGP12.phx.gbl ...
Thread.Abort() is a method you should only call to abort the current thread,
the only valid reason to call it on another thread is when you intend to
unload the application domain anyway.
There are numerous things that can go wrong when aborting another thread,
Please search the archives, this has been discussed several times before in
this and other NG''s.

Willy.

"Urs Vogel" <uv****@msn.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...


我写了一个应用服务器(一个远程处理单元),在非常罕见的情况下,必须通过Thread.Abort()完成进程。偶尔,只有在Thread.Abort()之后,这个组件变得不稳定,抛出像Windows一样的错误(访问冲突在0x00000002上),而不是一个
框架异常。组件及其所有子组件都是100%的托管代码。 Thread.Abort()会出现什么问题?

感谢任何提示。
Urs
Hi

I wrote an application server (a remoting sinlgeton), where processes must
be stopped in very rare cases, done thru a Thread.Abort(). Occasionally,
and only after a Thread.Abort(), this component becomes instabile,
throwing a Windows like error (access violation on 0x00000002), not an
framework exception. The component and all of its subcomponents are 100%
managed code. What could go wrong with Thread.Abort()?

Thanks for any hints.
Urs



是你的app服务器与任何系统资源交互?这可能会导致

这个。

查看ManualResetEvent类,这是一个调用可以发出运行

线程的信号,表明发生了重要事情(用户单击取消例如)

它可以优雅地中止。我记得读过一篇包含代码示例的文章

如何做到这一点,不记得在哪里。


" Urs Vogel"写道:
Is your app server interacting with any system resources? That could cause
this.
Look into ManualResetEvent class, it''s a call that can signal a running
thread that something important happened (user clicked cancel for example)
and it can abort gracefully. I remember reading an article with code samples
on how to do that, can''t remember where.

"Urs Vogel" wrote:


我写了一个应用程序服务器(一个远程处理单元),在极少数情况下必须停止进程,通过一个Thread.Abort()。偶尔,只有在一个Thread.Abort()之后,这个组件变得不稳定,抛出一个像Windows一样的错误(访问冲突在0x00000002上),而不是一个框架
异常。组件及其所有子组件都是100%托管代码。
Thread.Abort()可能出现什么问题?

感谢任何提示。
Urs
Hi

I wrote an application server (a remoting sinlgeton), where processes must
be stopped in very rare cases, done thru a Thread.Abort(). Occasionally, and
only after a Thread.Abort(), this component becomes instabile, throwing a
Windows like error (access violation on 0x00000002), not an framework
exception. The component and all of its subcomponents are 100% managed code.
What could go wrong with Thread.Abort()?

Thanks for any hints.
Urs



或升级到已解决此问题的.NET Framework 2.0!


星期二,8月16日2005 17:27:27 +0200,Willy Denoyette [MVP]

< wi ************* @ telenet.be>写道:
Or upgrade to .NET Framework 2.0 where this issue has been fixed!

On Tue, 16 Aug 2005 17:27:27 +0200, "Willy Denoyette [MVP]"
<wi*************@telenet.be> wrote:
Thread.Abort()是一个你应该只调用中止当前线程的方法,
在你打算在另一个线程上调用它的唯一有效理由是无论如何都要卸载应用程序域。
在中止另一个帖子时有很多可能出错的事情,
请搜索档案,这已经多次讨论了
这个和其他NG'。

Willy。
Thread.Abort() is a method you should only call to abort the current thread,
the only valid reason to call it on another thread is when you intend to
unload the application domain anyway.
There are numerous things that can go wrong when aborting another thread,
Please search the archives, this has been discussed several times before in
this and other NG''s.

Willy.



-
http://www.kynosarges.de


这篇关于Thread.Abort的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆