Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

General Threading Questions

I'm kind of new to threading in C# and had a couple of questions about what is out there:

  • What are the ways to implement threads in C#? (i.e. I can think of two off the top: backgroundWorker, Thread, etc)

    • How do you cause deadlock and if there is deadlock how do you get out of it (in C#)?

    • How does backgroundworker get implemented? It seems to have an underlying set of methods, but I'd like to know what those methods and instantiations are...

Thanks!

like image 561
locoboy Avatar asked Nov 03 '10 19:11

locoboy


1 Answers

The definitive beginner's guide to threading in C# is here: http://www.albahari.com/threading/

The documentation on BackgroundWorker, with a complete working example, is here: http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx

Deadlocks are explained here: http://www.albahari.com/threading/part2.aspx

Threads can be implemented in many ways. You can use them directly, pull them from a ThreadPool, or use them indirectly using the Task Parallel Library.

like image 125
Robert Harvey Avatar answered Oct 21 '22 04:10

Robert Harvey