http://www.albahari.com/threading
It started out as a chapter in a book that I'm writing, but ended up outgrowing the book! So I'm making it free and maintaining it in parallel as a separate project.
Any feedback would be welcome.
I'm particularly interested in comments in regard the Wait and Pulse section. I'm proposing a design pattern that makes Wait and Pulse as simple to use as an AutoResetEvent (well, almost!)
Here's what's covered:
Getting Started
Overview and Concepts
Creating and Starting Threads
Basic Synchronization
Synchronization Essentials
Locking and Thread Safety
Interrupt and Abort
Thread State
Wait Handles
Synchronization Contexts
Using Threads
Apartments and Windows Forms
BackgroundWorker
ReaderWriterLock
Thread Pooling
Timers
Local Storage
Advanced Topics
Non-Blocking Synchronization
Wait and Pulse
Suspend and Resume
Aborting Threads
Regards,
Joe Albahari

Article on Threading in C#
GabeFUller
remedy
>Scenario #1
>Execute a SQL statement (constructed with ad hoc query builder tool) using System.Data.SqlClient classes and allow the user to abort the SQL statement if it takes longer to run than they are willing to wait.
With this you have two options: either specify a CommandTimout or call Cancel on the SqlCommand object executing the query. In order to call Cancel, you would have to execute the command on another thread (eg with BackgroundWorker), so the main (UI) thread can service the Cancel button and call the SqlCommand object's Cancel method.
>Scenario #2
>Same as #1, except that the SQL statement is first sent to a web service and then executed from the web server.
The easiest way to handle this it to create a worker thread or use BackgroundWorker to call the web service. Then, when the user cancels, instead of calling Cancel on the SqlCommand object, you simply abandon the worker thread or BackgroundWorker object.Regards
Joe
pablo_q
Joe,
I greatly appreciate you posting the ebook on async / threading in .NET !!
I am struggling with what I believe is are very common async requirements and would like to consider any suggestions you have:
Scenario #1
Execute a SQL statement (constructed with ad hoc query builder tool) using System.Data.SqlClient classes and allow the user to abort the SQL statement if it takes longer to run than they are willing to wait.
Scenario #2
Same as #1, except that the SQL statement is first sent to a web service and then executed from the web server.
Thanks again,
-Mike Graham
Technical Media, LLC
Row Level Security for SQL Server 2005