Threading in c#

Páginas: 180 (44907 palabras) Publicado: 1 de noviembre de 2010
Threading in C#
Joseph Albahari
Last updated 2010-8-13

Interested in a book on C# and .NET by the same author?
See www.albahari.com/nutshell/

Table of Contents
Part 1: Getting Started ..................................................................... 4
Introduction and Concepts .............................................................................. 4 Join and Sleep....................................................................................... 6 How Threading Works ......................................................................... 7 Threads vs Processes ............................................................................ 7 Threading’s Uses and Misuses ............................................................. 8 Creating and StartingThreads ........................................................................ 8 Passing Data to a Thread ...................................................................... 9 Naming Threads ................................................................................. 11 Foreground and Background Threads ................................................ 11 ThreadPriority.................................................................................... 12 Exception Handling ............................................................................ 12 Thread Pooling.............................................................................................. 14 Entering the Thread Pool via TPL ...................................................... 15 Entering the ThreadPool Without TPL .............................................. 16 Optimizing the Thread Pool ............................................................... 17

Part 2: Basic Synchronization....................................................... 19
Synchronization Essentials ........................................................................... 19 Blocking............................................................................................. 19 Blocking Versus Spinning .................................................................. 20 ThreadState ......................................................................................... 20 Locking ......................................................................................................... 21Monitor.Enter and Monitor.Exit ......................................................... 22 Choosing the Synchronization Object ................................................ 23 When to Lock ..................................................................................... 23 Locking and Atomicity ....................................................................... 24 NestedLocking................................................................................... 24 Deadlocks ........................................................................................... 25 Performance........................................................................................ 26 Mutex.................................................................................................. 26Semaphore .......................................................................................... 27

© 2006-2010 Joseph Albahari, O’Reilly Media, Inc. All rights reserved. www.albahari.com/threading/

1

Thread Safety ................................................................................................ 28 Thread Safety and .NET Framework Types....................................... 28 Thread Safety in Application Servers................................................. 30 Rich Client Applications and Thread Affinity ................................... 30 Immutable Objects.............................................................................. 32 Signaling with Event Wait Handles .............................................................. 33 AutoResetEvent...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Programming in C
  • Ascii art in c
  • Chopin Nottturno In C#Minore
  • Nocturne In C Sharp Minor
  • 37 C 4 in Spanish
  • Estudio De D. Rosenhan Y C. Paniagua “Living In Manicomio”
  • Sonido In
  • la in

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS