Index_T

 < Day Day Up > 



T

Task Manager

administrating priorities, 20

Excel example, 20

comparing thread usage in examples, 168

CPU utilization

threads, 11

OS processes, 52

Thread Count option, 15

viewing processes, 10

TcpClient class, System.Net.Sockets namespace, 230

GetStream method, 238

instantiating, 236, 237

TcpListener class, System.Net.Sockets namespace, 230

AcceptTcpClient method, 248

Text property, Form class, 233

TextWriterTraceListener class, System.Diagnostics namespace, 206, 209, 218

Close method, 209

creating new instance, 210

Datalmport example, 217

thread abort, 18

Thread Affinity, 141

Thread class, System.Threading namespace, 28, 32

creating threads, 140

Datalmport example, 217

inheritance, 22

methods, 33,41

Abort method, 54, 65, 66

Join method, 54, 66

Sleep method, 41, 54, 88, 153

Start method, 37

Wait method, 54

properties, 34, 41

ApartmentState property, 143

IsAlive property, 41

Thread Local Storage

see TLS.

thread pool manager

creating, 177

FindIdleThreadCount function, 184

GenThreadPoolImpl class, 177

implements the IThreadPool interface, 179

specifying min, max and idle time of threads, 180

GetStats function,implementation, 183

IThreadPool interface, 177

AddJob method, 181

Pulse method, Monitor class, 183

ThreadElement class, 182, 187

thread pooling, 158

benefits, 158

concept of, 158

multi-threaded applications, 158

need for, 158

role of CLR, 160

size of thread pool, 161

thread priorities, 18, 19

administrating priorities, 20

thread sleep, 17

thread_interrupt example, 57

thread_joining example, 66

thread_priority example, 43

thread_priority2 example, 44

thread_sleep example, 41

thread_sleep2 example, 55

thread_sleep3 example, 56

thread_spinning example, 48

thread_spinning2 example, 50

thread_timer example, 46

ThreadAbortException class, System.Threading namespace, 32, 54, 65

ThreadDemo example

ThreadPool class, System.Threading namespace, 166

threads usage, 168

threaded applications

scaling, 157

Threaded_Resource example, 71

Threaded_Search example, 69

ThreadExceptionEventArgs class, System.Threading namespace, 32

threading

see also threads and thread pooling.

threading defined

clock interrupts, 17

executing code within a specified AppDomain, 26

free threading, 7

interrupts, 15

multitasking, 8

cooperativeness, 8

pre-emptive multitasking, 9

multithreaded processes, 12

free threading, 12

processes, 10

setting AppDomain data, 23

single threaded processes, 11

thread abort, 18

thread priorities, 18

thread sleep, 17

time slices, 12

TLS (Threads Local Storage), 15

unmanaged threads, 28

threading opportunities, 68

accessing external resources, 71

background processes, 69

threading traps

execution order, 73

threads in a loop, 76

ThreadInterruptedException class, System.Threading namespace, 32

ThreadPool class, System.Threading namespace, 32, 161

examples

ThreadDemo example, 166

ThreadPoolDemo example, 166

ThreadPoolState example, 170

exploring, 162

methods, 162

BindHandle method, 163

GetAvailableThreads method, 163

GetMaxThreads method, 163

QueueUserWorkltem method, 163, 170, 172

RegisterWaitForSingleObject method, 164, 172

UnsafeQueueUserWorkltem method, 165

UnsafeRegisterWaitForSingleObject method, 165

programming in C#, 166

rules, 166

ThreadPoolDemo example

ThreadPool class, System.Threading namespace, 166

threads usage, 169

ThreadPoolState example

passing and returning values, 170

ThreadPriority enumeration, System.Threading namespace

defining priorities, 43

threads

see also threading defined, thread pooling, and thread safety.

AppDomain class and, 21

blocking, 54

callbacks, 45

concurrency, 139

creating

multi-threading example, 37

simple_thread example, 35

designing

principles, 139

multi-threaded applications, 159

threaded applications, 143

lifecycle, 53

management and .NET runtime, 28

MTA threading model, 142

networking and, 227

opportunities for, 68

overusing, 67

priorities, 43

scaling threaded applications, 157

spawning multiple threads within a thread, 48

specifying threading model, 143

STA (Single Threaded Apartments), 140

support in .NET and C#, 21

thread pooling, 158

threading traps, 73

timers, 45

TLS and Call Stacks, 159

traps, 73

when to use, 31, 67

threads and relationships, 145

Main and Worker thread model, 146

Peer thread model, 149

Pipeline thread model, 153

Threads window

columns contained, 201

debugging threads, 201

thread-safe wrapper

using, 85

thread-safe wrappers example, 119

Book Collection Library, 120

thread-safety, 81

costs, 82

ensuring, 82

ways to achieve, 83

making object immutable, 84

synchronize critical sections of code, 83

using a thread-safe wrapper, 85

ThreadStart delegate, System.Threading namespace

using as parameter of Thread constructor

execution branching example, 38

ThreadStartBranching example, 39

ThreadState enumeration, System.Threading namespace

Suspend value, 61

SuspendRequested value, 61

values, 53

WaitSleepJoin state, 55, 57, 66

ThreadState property, Thread class, 35, 53

testing with If statement, 43

using ToString method to write out state, 43

ThreadStateException class, System.Threading namespace, 32, 61

ThreadStaticAttribute class, System namespace

static variables and methods synchronization, 113

time slices, 12

Timeout class, System.Threading namespace, 33

Timer class, System.Threading namespace, 33, 46

TimerCallback delegate, System.Threading namespace, 46

timers, 46

TimeSpan structure, System namespace, 46, 175

FromMinutes method, 56

FromSeconds method, 56

properties and methods, 56

TLS (Thread Local Storage), 11, 15

storing, 17

ToString method, StringBuilder class, 242

Trace class, System.Diagnostics namespace, 202

IndentLevel property, 211

Listeners collection, 203

methods, 203

Assert method, 203

Fail method, 203

Write method, 203

Writelf method, 203, 212

WriteLine method, 203

WriteLinelf method, 203, 212

Shared declaration, 202

Trace statements

stripping from application, 212

TraceExample1

default listener application, 203

TraceListener collection class, System.Diagnostics namespace

RemoveAt method, 208

TraceSwitch class, System.Diagnostics namespace, 202

hierarchy of levels, 214

TraceSwitch example, 214

tracing, 193

listeners, 193

tracing switches, 211

BooleanSwitch class, 212

TraceSwitch class, 214

TryEnter method, Monitor class

example, 99

synchronized code regions, 99



 < Day Day Up > 



C# Threading Handbook
C# Threading Handbook
ISBN: 1861008295
EAN: 2147483647
Year: 2003
Pages: 74

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net