本文介绍了忘记.NET中的合作多任务处理?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




经过各种问题(在这里和其他地方)似乎是prrem>

多任务是使用.NET的方法。但关于coorporative

多任务?虽然这在win32中如此强大且易于操作?好吧它是

仍然可能,但它似乎只有P / Invoke的东西,并使用旧的方式。

但当我问queston每个人都跟我说话使用线程,时候通常(或不是)nececary这是

。即使使用非阻塞的东西(例如用于TCP的

),它也是优先的。它只是启动另一个(阻塞)线程。


我开始喜欢.NET,因为我知道它的一点点(非常一点点),

但是这是我不喜欢的。请帮我清醒一下:)


-

rgds,Wilfried

推荐答案




使用Application.DoEvents实际上是合作多任务 -

我建议避免使用。


使用线程很棘手,但我认为这比使用合作多任务试图保持一切顺利是一个更好的解决方案。



对我而言,合作社基本上是一种伪装的方式,直到先发制人

多任务处理可用。您认为使用合作多任务而不是先发制人的优势是什么?


-

Jon Skeet - < sk *** @ pobox.com>


如果回复小组,请不要给我发邮件



Using Application.DoEvents is effectively co-operative multitasking -
and something I recommend avoiding.

Using threads is tricky, but I think it''s a better solution overall
than trying to keep everything straight with co-operative multitasking.
To me, co-op was basically a way of faking things until pre-emptive
multitasking was available. What do you think are the advantages of
using co-operative multitasking rather than pre-emptive?

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too





你想在自己的应用程序中进行合作多任务吗?然后不要使用

线程。只需编写状态机和调度程序,以及状态处理程序形式的

应用程序。


Frans。


-

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

获得LLBLGen Pro,高效O. .NET的/ R映射:

我的.NET博客:

Microsoft MVP(C#)

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



You want co-operative multitasking in your own application? Don''t use
threads then. Simply write a state-machine and a scheduler, and your
application in the form of state handlers.

Frans.

--
------------------------------------------------------------------------
Get LLBLGen Pro, productive O/R mapping for .NET: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------





出于某种原因,微软一般/恐惧/线程。


任何东西允许Windows更高效,并且让人们不必购买升级版本以期获得更快的机器,必须避开。


这就是为什么2.6内核吹掉了Windos的门。



-

你看,在这个世界上有两种类型的人,我的朋友:

装有枪的人和挖掘的人。你挖。

-C。 Eastwood,G,B& U



For some reason, Microsoft in general /fears/ threads.

Anything that allows Windows to be more efficient, and keep people from
buying upgrades in the hopes of getting a faster machine, must be shunned.

That is why the 2.6 kernel blows the doors off Windos.


--
"You see, in this world there are two types of people, my friend:
those with loaded guns and those who dig. You dig."
-C. Eastwood, G,B&U


这篇关于忘记.NET中的合作多任务处理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-24 16:49