未解决/管理问题可能存在巨大线索 [英] Possible huge clue into unmanged/managed problem

查看:39
本文介绍了未解决/管理问题可能存在巨大线索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我发布了一个关于间歇性问题的查询,其中包含一个包含在非托管C ++中的非托管C DLL,包含在托管C ++中的
,所有访问过的通过C#)。在没有压力的情况下系统运行良好

,但是在压力下失败了。


嗯......我刚注意到Prosise的书中提及的一切地方,

重新线程。他指出,在
托管线程中非托管代码的行为是不可预测的。我原以为嵌入式非托管类中有组织的

内部分配/关闭是好的,足以使事情保持一致。也许没有。


我是否需要将所有非托管代码输出到非托管线程?

(Yechh!)这是否记录在任何地方?


_B

Recently I had posted a query about intermittent problems with a
C++/Interop scheme (unmanaged C DLL wrapped in unmanaged C++,
wrapped in managed C++, all accessed by C#). The system works fine
when unstressed, but fails under stress.

Well...I just noticed short mention in Prosise''s book, of all places,
re threading. He indicated that the behavior of unmanaged code within
managed threads is not predictable. I had thought that the organized
internal alloc/shutdown within the embedded unmanaged classes was
good enough to keep things in line. Maybe not.

Do I need to take all the unmanaged code out to an UNmanaged thread?
(Yechh!) Is this documented anywhere?

_B

推荐答案

我不这么认为。 Prosise'声明的背景是什么?我敢肯定,如果你发布复制/总结,你不会侵犯文案


-

问候,

Alvin Bruney [MVP ASP.NET]


[无耻作者插件]

Microsoft Office Web Components黑皮书.NET

现已推出@ http://tinyurl.com/27cok

---------------------------------------- ------------------

" _BNC" < _B ** @ noemail.org>在消息中写道

新闻:在******************************** @ 4ax.com ...
I wouldn''t think so. What is the context of Prosise'' statement? I''m sure it
won''t infringe copywrites if you post a replication/summation

--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ http://tinyurl.com/27cok
----------------------------------------------------------
"_BNC" <_B**@noemail.org> wrote in message
news:in********************************@4ax.com...
最近我发布了一个关于间歇性问题的查询,其中包含一个/或C ++ / Interop方案(非托管C ++包裹在非托管C ++中,包含在托管C ++中,所有访问过的)通过C#)。在没有压力的情况下系统工作正常,但在压力下失败。

嗯......我刚注意到Prosise的书中所提到的所有地方的短暂提及,
重新穿线。他指出,管理线程中非托管代码的行为是不可预测的。我原以为嵌入式非托管类中有组织的内部分配/关闭足够好,可以保持一致。也许不是。

我是否需要将所有非托管代码输出到非管理线程?
(Yechh!)这是否记录在任何地方?

_B
Recently I had posted a query about intermittent problems with a
C++/Interop scheme (unmanaged C DLL wrapped in unmanaged C++,
wrapped in managed C++, all accessed by C#). The system works fine
when unstressed, but fails under stress.

Well...I just noticed short mention in Prosise''s book, of all places,
re threading. He indicated that the behavior of unmanaged code within
managed threads is not predictable. I had thought that the organized
internal alloc/shutdown within the embedded unmanaged classes was
good enough to keep things in line. Maybe not.

Do I need to take all the unmanaged code out to an UNmanaged thread?
(Yechh!) Is this documented anywhere?

_B



On Mon,2005年1月31日12:05:54 -0400,Alvin Bruney [MVP]" <蒸汽在

蒸邮局>写道:
On Mon, 31 Jan 2005 12:05:54 -0400, "Alvin Bruney [MVP]" <vapor at
steaming post office> wrote:
我不这么认为。 Prosise'声明的背景是什么?我确定如果你发布复制/总结就不会侵犯文案
I wouldn''t think so. What is the context of Prosise'' statement? I''m sure it
won''t infringe copywrites if you post a replication/summation




我怀疑Jeff会介意的。 p668,在''终止线程''下:


" Abort在目标线程中抛出ThreadAbortException,导致

线程编辑。线程可能不会立即结束;事实上,它并不是保证完全结束的。如果线程已经调出非托管代码,例如
,并且还没有返回,它就不会终止,直到它开始

再次执行托管代码。 ... ...


我对Jeff的书中的非托管代码没有多少期望,但我仍然没有得到
没有得到牢牢抓住mgd / unmgd中发生的事情,所以在我的余下时间里,我已经梳理了所有书籍并提到了非托管的

代码。


我认为上面的场景可能会发生,因为原始代码是

设计为循环直到它得到结果 - 或者直到它的线程被中止。

我没想到*托管的线程*不能再控制线程内的一些代码了。这些症状并不是一成不变的,

但是这个程序是相同的。



I doubt that Jeff would mind. p668, under ''terminating threads'':

"Abort throws a ThreadAbortException in the targeted thread, causing the
thread to edn. The thread might not end immediately; in fact, it''s not
guaranteed to end at all. If the thread has called out to unmanaged code,
for example, and hasn''t yet returned, it doesn''t terminate until it begins
executing managed code again. ..."

I hadn''t expected much on unmanaged code in Jeff''s book, but I still
haven''t got a solid grip on what is going on in mgd/unmgd, so in my spare
time I''ve been combing through all my books and references to unmanaged
code.

The scenario above could happen, I think, as the original code was
designed to loop til it got a result-- or until its thread was aborted.
It hadn''t occurred to me that the *managed thread* can no longer control
some of the code inside the thread. The symptoms don''t all match up,
but that''s par for this program.


我没看过你的关于你的问题的老帖子但是

我认为一个好的设计是避免像Thread.Abort

或/和TerminateThread这样的方法,因为它们总是会让你
$ b 长中的$ b问题跑。当你想要关闭你的线程时,我认为需要一个更有控制的信号



你可以使用w32事件对象来发送这个通知,

也可以从托管代码中访问这些内容


// daniel


" _BNC"写道:
I didn''t read your old post about your problem but
I think a good design is to avoid methods like Thread.Abort
or / and TerminateThread since they always cause you
problem in the "long" run. I think a more controlled signal
is needed when you whish to shut down your thread.
You could use an w32 event object for this notification,
it is possible to access these from managed code as well

// daniel

"_BNC" wrote:
2005年1月31日星期一12:05:54 -0400,Alvin Bruney [MVP]" <蒸汽邮局>写道:
On Mon, 31 Jan 2005 12:05:54 -0400, "Alvin Bruney [MVP]" <vapor at
steaming post office> wrote:
我不这么认为。 Prosise'声明的背景是什么?我确定如果你发布复制/总结就不会侵犯文案
I wouldn''t think so. What is the context of Prosise'' statement? I''m sure it
won''t infringe copywrites if you post a replication/summation



我怀疑Jeff会介意的。 p668,在''终止线程''下:中止在目标线程中抛出ThreadAbortException,导致
线程被编辑。线程可能不会立即结束;事实上,它并没有保证完全结束。如果线程已经调用了非托管代码,例如,并且还没有返回,则在它开始再次执行托管代码之前它不会终止。 ......

我对Jeff的书中的非托管代码没有太多期待,但我仍然没有抓住正在发生的事情。在mgd / unmgd中,所以在我多余的时间里,我一直在梳理我的所有书籍和对非托管代码的引用。

上面的场景可能会发生,我想,因为原始代码被设计为循环直到它得到结果 - 或者直到它的线程被中止。
我没想到*托管线程*不能再控制
线程内部的一些代码。这些症状并不是一成不变的,
但这与此计划相同。



I doubt that Jeff would mind. p668, under ''terminating threads'':

"Abort throws a ThreadAbortException in the targeted thread, causing the
thread to edn. The thread might not end immediately; in fact, it''s not
guaranteed to end at all. If the thread has called out to unmanaged code,
for example, and hasn''t yet returned, it doesn''t terminate until it begins
executing managed code again. ..."

I hadn''t expected much on unmanaged code in Jeff''s book, but I still
haven''t got a solid grip on what is going on in mgd/unmgd, so in my spare
time I''ve been combing through all my books and references to unmanaged
code.

The scenario above could happen, I think, as the original code was
designed to loop til it got a result-- or until its thread was aborted.
It hadn''t occurred to me that the *managed thread* can no longer control
some of the code inside the thread. The symptoms don''t all match up,
but that''s par for this program.



这篇关于未解决/管理问题可能存在巨大线索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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