How To Start A Thread

How To Start A Thread

 In this lecture, I will teach you how to start new threads using the System. Thread class: the workhorse of multi-threaded programming in C#. 

 I will also show you how you can give a descriptive name to a thread, to aid in debugging. 

 Finally, you will learn that there are two classes of threads: foreground- and background threads. I will show you the difference in behavior between these two classes of threads. 

Write Multithreaded C# Code

Buy nowLearn more

Introduction

  • Course Introduction
  • Introduction To Threading
  • Windows, OS/X or Linux?

Working With Threads

  • Section Introduction
  • How To Start A Thread
  • First Problem: Race Conditions
  • Passing In Data To A Thread
  • Second Problem: Waiting On A Thread
  • Joining And Suspending Threads
  • Interrupting And Aborting Threads
  • Section Recap
  • Quiz 1: Working with threads

Introducing Thread Locking

  • Section Introduction
  • When Should You Lock Threads?
  • The Lock Statement
  • Dealing With Deadlocks
  • Assignment: Have Dinner With The Philosophers
  • Using The Interlocked Class
  • Section Recap
  • Quiz 2: Thread Locking

How To Synchronize Threads

  • Section Introduction
  • Thread Synchronization With AutoResetEvents
  • How To Build A Producer/Consumer Queue
  • The ManualResetEvent Class
  • The CountdownEvent Class
  • Thread Rendezvous
  • Section Recap
  • Quiz 3: Thread Synchronization

Final Words

  • Course Recap