clr threads

6
CLR Threads and the Async Programming Model Florin Cardaşim Lead developer RomSoft, IAŞI, http://www.rms.ro

Upload: florin-cardasim

Post on 12-May-2015

429 views

Category:

Documents


0 download

DESCRIPTION

Quick review of the therading options in .NET.

TRANSCRIPT

Page 1: CLR threads

CLR Threads and the Async Programming ModelCLR Threads and the Async Programming ModelFlorin CardaşimLead developerRomSoft, IAŞI, http://www.rms.ro

Florin CardaşimLead developerRomSoft, IAŞI, http://www.rms.ro

Page 2: CLR threads
Page 3: CLR threads

AgendaAgenda

• Thread, Thread.IsBackgound, ThreadStart, Exceptions(.NET 1.1 vs 2.0)

• ThreadPool

• Asynchronous Programming Model: BeginInvoke, EndInvoke, AsyncCallback, IAsyncResult

• Thread, Thread.IsBackgound, ThreadStart, Exceptions(.NET 1.1 vs 2.0)

• ThreadPool

• Asynchronous Programming Model: BeginInvoke, EndInvoke, AsyncCallback, IAsyncResult

Page 4: CLR threads

ConclusionsConclusions

• Use ThreadPool and the APM whenever possible!

• When to use dedicated Thread:• Start with high priority; TP - normal• Foreground; TP - background• Long running operations• Control the thread’s lifetime

(Thread.Abort)

• Always catch and handle the exceptions

• Use ThreadPool and the APM whenever possible!

• When to use dedicated Thread:• Start with high priority; TP - normal• Foreground; TP - background• Long running operations• Control the thread’s lifetime

(Thread.Abort)

• Always catch and handle the exceptions

Page 5: CLR threads

Q&AQ&A

Page 6: CLR threads

Thank you!Thank you!

Florin CardaşimLead developerRomSoft, IAŞI, http://www.rms.ro

Florin CardaşimLead developerRomSoft, IAŞI, http://www.rms.ro