Похожее видео
Multi-threading in .net: introduction and suggestions Multi-threading in .NET: Introduction and suggestions Multi-threading in .NET: Introduction and suggestions One of the greatest understatements Ive heard in a newsgroup was made by Patricia Shanahan in a Java newsgroup in 2001: Multi-threaded programming needs a little care. Multi-threading is probably one of the worst understood aspects of programming and these days almost all application programmers need to understand it to some extent. This article acts as an introduction to multi-threading and gives some hints and tips for how to do it safely. Warning: Im not an expert on the subject and when the real experts start discussing it in detail my head starts to spin somewhat. However Ive tried to pay attention to those who know what theyre doing and hopefully the contents of this article form at least part of a multi-threading best practice. This article uses the C type shorthands throughout - int for Int32 etc. I hope this makes it easier for C developers to read and wont impede any other developers too much. It also only talks about the C ways of declaring variables to be volatile and locking monitors. Developers using other languages can find the equivalents in their own preferred environment Im sure. This is a long article. Its almost certainly too long to read through properly in a single session. However I havent split it up into multiple pages as I have no idea where you want to stop and take a break. However you can skip back to where you were easily with the following section links: Introduction: What is multi-threading? How does multi-threading work in .NET? Multi-threaded Hello world Data races Exclusive access - Monitor.EnterExit and the lock statement Deadlocks More Monitor methods Volatility and stale data Atomicity A shortcut for some cases: the Interlocked class Choosing what to lock on Threading in Windows Forms The thread pool and asynchronous methods Timers Shutting down worker threads gracefully Collected hints and tips Resources,
Похожее видео