初学者在C#中的线程 [英] Beginners threading in C#

查看:92
本文介绍了初学者在C#中的线程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您可以推荐一个很好的系列文章或preferably一本书有关如何使用线程在一般和C#尤其是开始?
我主要是寻找在使用控制台应用程序,并在ASP.Net应用程序的线程。

Can you recommend a good series of articles or preferably a book on how to get started with threading in general and in C# in particular? I am primarily looking for the use of threads in console applications and in ASP.Net apps.

我明白只有线程非常基本的,知道这里是龙,所以想在它的基础知识之前,我开始使用它们。

I understand only the very basics of threads and know that "here be dragons", so want to get a good grounding in it before I start using them.

东西我好奇的事情就像有一个线程池,你如何管理它的大小,你如何选择要进行排队的事情,直到某个线程可用VS迫使一个新的线程启动等概念
另外,据我所知,IIS有很多内置的线程处理,所以任何解释如何使用线程在ASP.Net IIS下工作,它从一个控制台C#广告应用程式线程的不同之处是有趣的。

Things I am curious about are things like the concept of having a threadpool, how you manage the size of it, how you choose for things to be queued until a thread is available vs forcing a new thread to start etc. Also, I understand that IIS has lots of built-in thread handling, so anything that explains how to work with threads in ASP.Net under IIS and how it differs from threading in a console C# applicaion is interesting.

我的预期用途包括像;

My intended usage includes things like;


  • 用户不会导致我的服务器端code到需要连接到另一个系统,并进行长时间的操作在ASP.Net页面上的东西,所以我想控制通过快速返回给用户射击的行动到另一个线程。用户可以继续关注进展情况通过AJAX或者干脆搬走 - 网络毕竟是无状态的:)

  • The user does something on the ASP.Net page that causes my server-side code to need to connect to another system and carry out lengthy operations, so I want to return control to the user quickly by firing that action to another thread. The user can keep watching progress through AJAX or simply move away - the web is stateless after all :)

火和使用模式忘记(大量样品code在那里,我想更多地了解它们是如何工作)

Use of Fire and Forget patterns (lots of sample code out there, I want to understand more about how they work)

感谢

推荐答案

,以及我自己的文章由安德鲁联系,乔阿尔巴哈利有另一个教程

As well as my own articles linked by Andrew, Joe Albahari has another tutorial.

如果你想有一个真正彻底的检查,看乔·达菲的在Windows 并发编程。

If you want a really thorough examination, read Joe Duffy's Concurrent Programming in Windows.

这篇关于初学者在C#中的线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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