Cover

Jeffrey Richter and Threading

February 21, 2006
No Comments.

Url: http://www.amazon.com/gp/product/0735621632
I attended a great presentation this evening at the Atlanta .NET Users’ Group with Jeffrey Richter. I last saw Richter speak at WinDev, probably in '93 or '94.  He talked about threading design and aborting of threads in the 2.0 CLR. Some very good ideas about how to safely abort threads.

One thing he mentioned that is new in the 2.0 CLR is the idea that aborting threads now only throws an ThreadAbortException outside safe areas of code. I am working from memory, but I believe he said that when a thread is aborted it will wait until a thread is in a ‘Safe Place’.  Safe places are outside of Catch and Finally blocks; static constructors; and new places that can be defined in your own code.

He also discussed using AppDomains and destroying AppDomains in situations where aborting a thread still isn’t the preferred way of handling it (in that if the code that is being aborted may leave objects in invalid states), you can use an AppDomain to create a level of isolation and kill the AppDomain instead.  An interesting idea for the right situation.

Everyone go out on Wednesday and buy his new book, its likely a must read…