From the course: Threading in C#
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Other threading concepts
- [Lecturer] We're back to Visual Studio to cover some of the concepts that are important when it comes to threading. So let's start by creating a thread. And something very simple like PrintHelloWorld. We can resolve it using Control dot to get a method. And it could do anything, but for now we'll just do a very small running process. Now imagine that this process actually took, for example, let's say five seconds. So we're going to say Thread.Sleep, five seconds. And we can come here and start the thread. That means the first thing that happens is, a worker thread gets pawned off, prints Hello World and then waits five seconds. Well now, once this is done, we want to say something like Console.WriteLine, Hello World printed. And let's do Control F5. As you can see, Hello World printed will get printed before Hello World and then we have Hello World and then five seconds later the application stopped and now I can press any key to continue. So there are times like that, when even…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
Understanding threading2m 55s
-
(Locked)
Context switching7m 12s
-
(Locked)
Thread naming2m 33s
-
(Locked)
Shared resources2m 52s
-
(Locked)
Shared resources demo7m 35s
-
(Locked)
Threads vs. processes1m 1s
-
(Locked)
Local memory2m 50s
-
(Locked)
Thread pool2m 41s
-
(Locked)
Thread pool demo9m 49s
-
(Locked)
Other threading concepts3m 27s
-
(Locked)
Exception handling4m 37s
-
-
-
-