From the course: Java Threads
Unlock the full course today
Join today to access over 24,400 courses taught by industry experts.
Making a thread to wait until another thread terminates - Java Tutorial
From the course: Java Threads
Making a thread to wait until another thread terminates
- Multithreading is all about threads executing tasks - Multithreading is all about threads executing tasks at the same time. But we cannot guarantee the order in which they execute because the thread scheduler decides it. For example, if you create and start three threads in a sequence, the thread scheduler doesn't start and end them in the specified order. Sometimes you'll need to make sure that threads execute in a particular order. Because threads access the same data concurrently Because threads access the same data concurrently and it could lead to synchronization issues. For instance, there could be one thread storing data in a variable and another thread running concurrently, reading that data. If the first thread hasn't finished storing the data before the other thread tries to read it, it's going to cause a problem. Threads need to communicate with each other. For example, a thread could request other threads…
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
-
-
-
-
-
(Locked)
Pausing execution of a thread3m 52s
-
(Locked)
Interrupting a thread5m 42s
-
(Locked)
Implementing thread interruptions6m 13s
-
(Locked)
Making a thread to wait until another thread terminates5m 39s
-
(Locked)
Other useful methods of the Thread class2m 42s
-
(Locked)
Challenge: Webinar polling system1m 53s
-
(Locked)
Solution: Webinar polling system5m 9s
-
(Locked)
-